-
-
Save forficate/eeca6451fcecc0fb0776 to your computer and use it in GitHub Desktop.
Render, minify and compress Elm project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Html (..) | |
import Html.Attributes (..) | |
import Html.Events (..) | |
import List | |
import LocalChannel as LC | |
import Signal | |
-- Model | |
type alias Model = | |
{ thingy : String | |
} | |
init : Model | |
init = | |
{ thingy = "Hellow, orld!" | |
} | |
-- Update | |
type Action = NoOp | |
update : Action -> Model -> Model | |
update action model = | |
case action of | |
NoOp -> model | |
-- View | |
view : Model -> Html | |
view model = | |
div [] [ text model.thingy ] | |
-- Signals | |
main : Signal Html | |
main = Signal.map view model | |
model : Signal Model | |
model = Signal.foldp update init (Signal.subscribe actionChannel) | |
actionChannel : Signal.Channel Action | |
actionChannel = Signal.channel NoOp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ELM=elm-make | |
CLOSURE=java -jar compiler.jar | |
CLOSURE_FLAGS=-O ADVANCED --language_in ECMASCRIPT5 --jscomp_off globalThis | |
ELM_SRC=elm | |
STATIC_JS=static/js | |
default: elm | |
elm: $(STATIC_JS)/elm.min.js.gz | |
$(STATIC_JS)/elm.min.js.gz: $(STATIC_JS)/elm.min.js | |
gzip -f -k -9 $(STATIC_JS)/elm.min.js | |
$(STATIC_JS)/elm.min.js: $(ELM_SRC)/elm.js | |
$(CLOSURE) $(CLOSURE_FLAGS) --js $(ELM_SRC)/elm.js --js_output_file $(STATIC_JS)/elm.min.js | |
$(ELM_SRC)/elm.js: $(ELM_SRC)/Main.elm | |
cd $(ELM_SRC) && $(ELM) Main.elm | |
.PHONY: clean | |
clean: | |
rm $(ELM_SRC)/elm.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment