Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scottcorgan/28d1517de5fcdb5fb23394f6e45058b9 to your computer and use it in GitHub Desktop.
Save scottcorgan/28d1517de5fcdb5fb23394f6e45058b9 to your computer and use it in GitHub Desktop.
Sublime Text snippet for an Elm module template
<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