@@ -21,6 +21,7 @@ data ELM =
21 , separate_js :: Bool
21 , separate_js :: Bool
22 , only_js :: Bool
22 , only_js :: Bool
23 , import_js :: [FilePath]
23 , import_js :: [FilePath]
24+ , generate_noscript :: Bool
25 deriving (Data,Typeable,Show,Eq)
26 deriving (Data,Typeable,Show,Eq)
@@ -31,6 +32,7 @@ elm = ELM { make = False &= help "automatically compile dependencies."
31 , separate_js = False &= help "Compile to separate HTML and JS files."
32 , separate_js = False &= help "Compile to separate HTML and JS files."
32 , only_js = False &= help "Compile only to JavaScript."
33 , only_js = False &= help "Compile only to JavaScript."
33 , import_js = [] &= typFile &= help "Include a JavaScript file before the body of the Elm program. Can be used many times. Files will be included in the given order."
34 , import_js = [] &= typFile &= help "Include a JavaScript file before the body of the Elm program. Can be used many times. Files will be included in the given order."
35+ , generate_noscript = False &= help "Add generated <noscript> tag to HTML output."
35 help "Compile Elm programs to HTML, CSS, and JavaScript." &=
37 help "Compile Elm programs to HTML, CSS, and JavaScript." &=
36 summary "The Elm Compiler v0.3.5, (c) Evan Czaplicki"
38 summary "The Elm Compiler v0.3.5, (c) Evan Czaplicki"
@@ -40,17 +42,17 @@ main = do
40 mini <- getDataFileName "elm-runtime-0.3.5.js"
42 mini <- getDataFileName "elm-runtime-0.3.5.js"
41 compileArgs mini args
43 compileArgs mini args
43−compileArgs mini (ELM _ [] _ _ _ _) =
45+compileArgs mini (ELM _ [] _ _ _ _ _) =
44 putStrLn "Usage: elm [OPTIONS] [FILES]\nFor more help: elm --help"
46 putStrLn "Usage: elm [OPTIONS] [FILES]\nFor more help: elm --help"
45−compileArgs mini (ELM make files rtLoc split only js) =
47+compileArgs mini (ELM make files rtLoc split only js nscrpt) =
46− mapM_ (fileTo get what js $ fromMaybe mini rtLoc) files
48+ mapM_ (fileTo get what js nscrpt $ fromMaybe mini rtLoc) files
47 where get = if make then getModules [] else getModule
49 where get = if make then getModules [] else getModule
48 what = if only then JS else
50 what = if only then JS else
49 if split then Split else HTML
51 if split then Split else HTML
51data What = JS | HTML | Split
53data What = JS | HTML | Split
53−fileTo get what jsFiles rtLoc file = do
55+fileTo get what jsFiles noscript rtLoc file = do
54 ems <- get file
56 ems <- get file
55 jss <- concat `fmap` mapM readFile jsFiles
57 jss <- concat `fmap` mapM readFile jsFiles
56 case ems of
58 case ems of
@@ -61,7 +63,7 @@ fileTo get what jsFiles rtLoc file = do
61 html = name ++ ".html"
63 html = name ++ ".html"
62 in case what of
64 in case what of
63 JS -> writeFile js $ jss ++ concatMap jsModule ms
65 JS -> writeFile js $ jss ++ concatMap jsModule ms
64− HTML -> writeFile html . renderHtml $ modulesToHtml "" rtLoc jss ms
66+ HTML -> writeFile html . renderHtml $ modulesToHtml "" rtLoc jss noscript ms
65 Split -> do
67 Split -> do
66 writeFile html . renderHtml $ linkedHtml rtLoc js ms
68 writeFile html . renderHtml $ linkedHtml rtLoc js ms
67 writeFile js $ jss ++ concatMap jsModule ms
69 writeFile js $ jss ++ concatMap jsModule ms