summaryrefslogtreecommitdiff
path: root/standalone/no-th/haskell-patches/yesod-static_hack.patch
blob: 4cf977bae48d9968384ab43ad30573d9e5a1e90c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
From 885cc873196f535de7cd1ac2ccfa217d10308d1f Mon Sep 17 00:00:00 2001
From: dummy <dummy@example.com>
Date: Fri, 7 Mar 2014 02:28:34 +0000
Subject: [PATCH] avoid building with jsmin

jsmin needs language-javascript, which fails to build for android due to
a problem or incompatability with happy.

This also avoids all the TH code.
---
 Yesod/EmbeddedStatic/Generators.hs |  3 +--
 Yesod/Static.hs                    | 29 ++++++++++++++++++-----------
 yesod-static.cabal                 |  7 -------
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/Yesod/EmbeddedStatic/Generators.hs b/Yesod/EmbeddedStatic/Generators.hs
index e83785d..6b1c10e 100644
--- a/Yesod/EmbeddedStatic/Generators.hs
+++ b/Yesod/EmbeddedStatic/Generators.hs
@@ -43,7 +43,6 @@ import Language.Haskell.TH
 import Network.Mime (defaultMimeLookup)
 import System.Directory (doesDirectoryExist, getDirectoryContents, findExecutable)
 import System.FilePath ((</>))
-import Text.Jasmine (minifym)
 import qualified Data.ByteString.Lazy as BL
 import qualified Data.Conduit.List as C
 import qualified Data.Text as T
@@ -158,7 +157,7 @@ concatFilesWith loc process files = do
 
 -- | Convienient rexport of 'minifym' with a type signature to work with 'concatFilesWith'.
 jasmine :: BL.ByteString -> IO BL.ByteString
-jasmine ct = return $ either (const ct) id $ minifym ct
+jasmine ct = return ct
 
 -- | Use <https://github.com/mishoo/UglifyJS2 UglifyJS2> to compress javascript.
 -- Assumes @uglifyjs@ is located in the path and uses options @[\"-m\", \"-c\"]@
diff --git a/Yesod/Static.hs b/Yesod/Static.hs
index dd21791..37f7e00 100644
--- a/Yesod/Static.hs
+++ b/Yesod/Static.hs
@@ -37,8 +37,8 @@ module Yesod.Static
     , staticDevel
       -- * Combining CSS/JS
       -- $combining
-    , combineStylesheets'
-    , combineScripts'
+    --, combineStylesheets'
+    --, combineScripts'
       -- ** Settings
     , CombineSettings
     , csStaticDir
@@ -48,13 +48,13 @@ module Yesod.Static
     , csJsPreProcess
     , csCombinedFolder
       -- * Template Haskell helpers
-    , staticFiles
-    , staticFilesList
-    , publicFiles
+    --, staticFiles
+    --, staticFilesList
+    --, publicFiles
       -- * Hashing
     , base64md5
       -- * Embed
-    , embed
+    --, embed
 #ifdef TEST_EXPORT
     , getFileListPieces
 #endif
@@ -64,7 +64,7 @@ import Prelude hiding (FilePath)
 import qualified Prelude
 import System.Directory
 import Control.Monad
-import Data.FileEmbed (embedDir)
+import Data.FileEmbed
 
 import Yesod.Core
 import Yesod.Core.Types
@@ -135,6 +135,7 @@ staticDevel dir = do
     hashLookup <- cachedETagLookupDevel dir
     return $ Static $ webAppSettingsWithLookup (F.decodeString dir) hashLookup
 
+{-
 -- | Produce a 'Static' based on embedding all of the static files' contents in the
 -- executable at compile time.
 --
@@ -149,6 +150,7 @@ staticDevel dir = do
 -- This will cause yesod to embed those assets into the generated HTML file itself.
 embed :: Prelude.FilePath -> Q Exp
 embed fp = [|Static (embeddedSettings $(embedDir fp))|]
+-}
 
 instance RenderRoute Static where
     -- | A route on the static subsite (see also 'staticFiles').
@@ -214,6 +216,7 @@ getFileListPieces = flip evalStateT M.empty . flip go id
                 put $ M.insert s s m
                 return s
 
+{-
 -- | Template Haskell function that automatically creates routes
 -- for all of your static files.
 --
@@ -266,7 +269,7 @@ staticFilesList dir fs =
 -- see if their copy is up-to-date.
 publicFiles :: Prelude.FilePath -> Q [Dec]
 publicFiles dir = mkStaticFiles' dir "StaticRoute" False
-
+-}
 
 mkHashMap :: Prelude.FilePath -> IO (M.Map F.FilePath S8.ByteString)
 mkHashMap dir = do
@@ -309,6 +312,7 @@ cachedETagLookup dir = do
     etags <- mkHashMap dir
     return $ (\f -> return $ M.lookup f etags)
 
+{-
 mkStaticFiles :: Prelude.FilePath -> Q [Dec]
 mkStaticFiles fp = mkStaticFiles' fp "StaticRoute" True
 
@@ -356,6 +360,7 @@ mkStaticFilesList fp fs routeConName makeHash = do
                 [ Clause [] (NormalB $ (ConE route) `AppE` f' `AppE` qs) []
                 ]
             ]
+-}
 
 base64md5File :: Prelude.FilePath -> IO String
 base64md5File = fmap (base64 . encode) . hashFile
@@ -394,7 +399,7 @@ base64 = map tr
 -- single static file at compile time.
 
 data CombineType = JS | CSS
-
+{-
 combineStatics' :: CombineType
                 -> CombineSettings
                 -> [Route Static] -- ^ files to combine
@@ -428,7 +433,7 @@ combineStatics' combineType CombineSettings {..} routes = do
         case combineType of
             JS -> "js"
             CSS -> "css"
-
+-}
 -- | Data type for holding all settings for combining files.
 --
 -- This data type is a settings type. For more information, see:
@@ -504,6 +509,7 @@ instance Default CombineSettings where
 errorIntro :: [FilePath] -> [Char] -> [Char]
 errorIntro fps s = "Error minifying " ++ show fps ++ ": " ++ s
 
+{-
 liftRoutes :: [Route Static] -> Q Exp
 liftRoutes =
     fmap ListE . mapM go
@@ -550,4 +556,5 @@ combineScripts' :: Bool -- ^ development? if so, perform no combining
                 -> Q Exp
 combineScripts' development cs con routes
     | development = [| mapM_ (addScript . $(return $ ConE con)) $(liftRoutes routes) |]
-    | otherwise = [| addScript $ $(return $ ConE con) $(combineStatics' JS cs routes) |]
+    | otherwise = [| addScript $ $(return $ ConE con) $(combineStatics' JS cs routes) |]a
+-}
diff --git a/yesod-static.cabal b/yesod-static.cabal
index 3423149..416aae6 100644
--- a/yesod-static.cabal
+++ b/yesod-static.cabal
@@ -48,18 +48,12 @@ library
                    , data-default
                    , shakespeare-css       >= 1.0.3
                    , mime-types            >= 0.1
-                   , hjsmin
                    , process-conduit       >= 1.0      && < 1.1
                    , filepath              >= 1.3
                    , resourcet             >= 0.4
                    , unordered-containers  >= 0.2
 
     exposed-modules: Yesod.Static
-                     Yesod.EmbeddedStatic
-                     Yesod.EmbeddedStatic.Generators
-                     Yesod.EmbeddedStatic.Types
-
-    other-modules:   Yesod.EmbeddedStatic.Internal
 
     ghc-options:     -Wall
     extensions: TemplateHaskell
@@ -99,7 +93,6 @@ test-suite tests
                    , data-default
                    , shakespeare-css
                    , mime-types
-                   , hjsmin
                    , process-conduit
                    , filepath
                    , resourcet
-- 
1.9.0