on master help sign in
Remove minification from compiler.

Unix philosophy and all that.

commit66c288e4bac114c430d53b34d80ccba2dd166ab5 authorEvan Czaplicki <info@elm-lang.org> dateSat 28 Sep 2013, 15:36 (13 years ago) parentde232b6
3 files changed+8−23
Elm.cabal−2 compiler/Compiler.hs+5−13 compiler/Generate/Html.hs+3−8
Elm.cabal−2
@@ -87,7 +87,6 @@ Library
8787 containers >= 0.3,
8888 directory,
8989 filepath,
90− hjsmin,
9190 indents,
9291 language-ecmascript,
9392 mtl >= 2,
@@ -157,7 +156,6 @@ Executable elm
157156 containers >= 0.3,
158157 directory,
159158 filepath,
160− hjsmin,
161159 indents,
162160 language-ecmascript,
163161 mtl >= 2,
compiler/Compiler.hs+5−13
@@ -13,9 +13,7 @@ import System.FilePath
1313import System.IO
1414import GHC.Conc
1515
16−import qualified Text.Blaze.Html.Renderer.Pretty as Pretty
17−import qualified Text.Blaze.Html.Renderer.String as Normal
18−import qualified Text.Jasmine as JS
16+import Text.Blaze.Html.Renderer.Pretty (renderHtml)
1917import qualified Data.ByteString.Lazy.Char8 as BS
2018import qualified Data.ByteString.Lazy as L
2119
@@ -25,7 +23,7 @@ import SourceSyntax.Module
2523import Parse.Module (getModuleName)
2624import Initialize (buildFromSource, getSortedDependencies)
2725import Generate.JavaScript (jsModule)
28−import Generate.Html (createHtml, JSStyle(..), JSSource(..))
26+import Generate.Html (createHtml, JSSource(..))
2927import Paths_Elm
3028
3129import SourceSyntax.PrettyPrint (pretty, variable)
@@ -42,7 +40,6 @@ data Flags =
4240 , print_program :: Bool
4341 , scripts :: [FilePath]
4442 , no_prelude :: Bool
45− , minify :: Bool
4643 , cache_dir :: FilePath
4744 , build_dir :: FilePath
4845 }
@@ -64,8 +61,6 @@ flags = Flags
6461 &= help "Load JavaScript files in generated HTML. Files will be included in the given order."
6562 , no_prelude = False
6663 &= help "Do not import Prelude by default, used only when compiling standard libraries."
67− , minify = False
68− &= help "Minify generated JavaScript and HTML"
6964 , cache_dir = "cache" &= typFile
7065 &= help "Directory for files cached to make builds faster. Defaults to cache/ directory."
7166 , build_dir = "build" &= typFile
@@ -184,11 +179,11 @@ build flags rootFile = do
184179 (extension, code) <- case only_js flags of
185180 True -> do
186181 putStr "Generating JavaScript ... "
187− return ("js", genJs js)
182+ return ("js", js)
188183 False -> do
189184 putStr "Generating HTML ... "
190185 rtsPath <- getRuntime flags
191− return ("html", BS.pack . genHtml $
186+ return ("html", BS.pack . renderHtml $
192187 createHtml rtsPath (takeBaseName rootFile) (sources js) moduleName "")
193188
194189 let targetFile = buildPath flags rootFile extension
@@ -202,10 +197,7 @@ build flags rootFile = do
202197 do src <- BS.readFile (elmo flags filePath)
203198 return (BS.append src js)
204199
205− genHtml = if minify flags then Normal.renderHtml else Pretty.renderHtml
206− genJs = if minify flags then JS.minify else id
207− sources js = map Link (scripts flags) ++
208− [ Source (if minify flags then Minified else Readable) js ]
200+ sources js = map Link (scripts flags) ++ [ Source js ]
209201
210202
211203buildFiles :: Flags -> Int -> Interfaces -> String -> [FilePath] -> IO (String, Interfaces)
compiler/Generate/Html.hs+3−8
@@ -2,7 +2,6 @@
22module Generate.Html
33 (generateHtml,
44 createHtml,
5− JSStyle (..),
65 JSSource (..)
76 ) where
87
@@ -11,25 +10,21 @@ import qualified Text.Blaze.Html5 as H
1110import Text.Blaze.Html5 ((!))
1211import qualified Text.Blaze.Html5.Attributes as A
1312
14−import Text.Jasmine (minify)
1513import qualified Data.ByteString.Lazy.Char8 as BS
1614
1715import Initialize (buildFromSource)
1816import Generate.JavaScript
1917import Generate.Noscript
2018
21−data JSStyle = Minified | Readable
22−data JSSource = Link String | Source JSStyle BS.ByteString
19+data JSSource = Link String | Source BS.ByteString
2320
2421makeScript :: JSSource -> H.Html
2522makeScript source =
2623 case source of
2724 Link src -> H.script ! A.type_ "text/javascript" ! A.src (H.toValue src) $ ""
28− Source style src ->
25+ Source src ->
2926 H.script ! A.type_ "text/javascript" $
30− preEscapedToMarkup $ BS.unpack $ case style of
31− Minified -> minify src
32− Readable -> src
27+ preEscapedToMarkup $ BS.unpack src
3328
3429-- |This function compiles Elm code into simple HTML.
3530--