Last active
July 6, 2016 16:27
-
-
Save scottcorgan/28d1517de5fcdb5fb23394f6e45058b9 to your computer and use it in GitHub Desktop.
Sublime Text snippet for an Elm module template
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
<snippet> | |
<content><![CDATA[ | |
module ${1:ComponentName} exposing (..) | |
import Html exposing (..) | |
import Html.App | |
main : Program Never | |
main = | |
Html.App.program | |
{ update = update | |
, view = view | |
, init = init | |
, subscriptions = subscriptions | |
} | |
-- model | |
type alias Model = | |
{ | |
} | |
emptyModel : Model | |
emptyModel = | |
{} | |
-- update | |
type Msg | |
= NoOp | |
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
case msg of | |
NoOp -> | |
model ! [] | |
-- view | |
view : Model -> Html Msg | |
view model = | |
div | |
[] | |
[ text "Hello World!" ] | |
-- setup | |
init : ( Model, Cmd Msg ) | |
init = | |
emptyModel ! [] | |
subscriptions : Model -> Sub Msg | |
subscriptions model = | |
Sub.none | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>component</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.elm</scope> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment