Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- pull client example into a separate repo - remove npm stuff - set exposed modules and methods - documentation - readme
- Loading branch information
Showing
35 changed files
with
764 additions
and
1,622 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
elm-stuff/ | ||
node_modules/ | ||
tmp/ | ||
dist/ | ||
elm.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright (c) 2016, Jeff Schomay | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
|
||
* Neither the name of Jeff Schomay nor the names of other | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,70 @@ | ||
# elm-webpack-starter | ||
# Elm Narrative Engine | ||
|
||
A simple Webpack setup for writing [Elm](http://elm-lang.org/) apps: | ||
A framework for telling interactive stories, based on specific design principles: | ||
|
||
* Dev server with live reloading, HMR | ||
* Support for CSS/SCSS (with Autoprefixer), image assets | ||
* Bootstrap 3.3+ (Sass version) | ||
* Bundling and minification for deployment | ||
* Basic app scaffold, using `Html.App` | ||
* A snippet of example code to get you started! | ||
For the readers/players: | ||
|
||
* No command line interface (having to type "go north" or "inspect umbrella"), just simple point-and-click | ||
* More interaction and agency than simply choosing which branch to follow | ||
* Avoid clunky mechanics such as spacial navigation and object manipulation, and instead focus on the story | ||
|
||
### Install: | ||
``` | ||
git clone https://github.com/moarwick/elm-webpack-starter | ||
cd elm-webpack-starter | ||
npm install | ||
``` | ||
For authors: | ||
|
||
If you haven't done so yet, install Elm globally: | ||
``` | ||
npm install -g elm | ||
``` | ||
* Simple to use - focus on the story, not on the code | ||
* Declarative, data-driven approach - describe your story world and how it changes over time, the framework will take care of rest | ||
|
||
Install Elm's dependencies: | ||
``` | ||
elm package install | ||
``` | ||
## Getting Started | ||
|
||
### Serve locally: | ||
``` | ||
npm start | ||
``` | ||
* Access app at `http://localhost:8080/` | ||
* Get coding! The entry point file is `src/Main.elm` | ||
* Browser will refresh automatically on any file changes.. | ||
See https://github.com/jschomay/elm-interactive-story-starter.git for everything you need to get started, including an example story you can modify with your own content. | ||
|
||
Or just get started immediately with `npm i elm-interactive-story-starter` | ||
|
||
### Build & bundle for prod: | ||
``` | ||
npm run build | ||
``` | ||
## Basic Usage | ||
|
||
* Files are saved into the `/dist` folder | ||
* To check it, open `dist/index.html` | ||
Step 1: Define your "story elements" (items, locations, and characters) | ||
|
||
```elm | ||
type MyItem | ||
= Umbrella | ||
... | ||
|
||
### Changelog | ||
|
||
**Ver 0.6.2** | ||
* Use `copy-webpack-plugin` instead of `cp` to copy files (Windows compatible) | ||
items : MyItem -> ItemInfo | ||
items item = | ||
case item of | ||
Umbrella -> | ||
itemInfo "Umbrella" "Your trusty umbrella, you bring it everywhere with you." | ||
... | ||
``` | ||
|
||
**Ver 0.6.0** | ||
* `elm-hot-loader` is back (no Elm code changes required!) | ||
* Switch to [bootstrap-sass](https://www.npmjs.com/package/bootstrap-sass) to demo CSS | ||
Step 2: Define your declarative "story rules," broken up into "scenes" | ||
|
||
```elm | ||
scene1rules = | ||
[ interactingWith (item Umbrella) | ||
`when` (unless (withItem Umbrella)) | ||
`changesWorld` [ addInventory Umbrella ] | ||
`narrates` takingUmbrella | ||
, interactingWith (item Umbrella) | ||
`when` (inLocation Swamp) | ||
`changesWorld` [ ] | ||
`narrates` startingToRain | ||
... | ||
] | ||
|
||
takingUmbrella = | ||
"Never leave home without it." | ||
|
||
startingToRain = | ||
"Good thing your brought your umbrella..." | ||
``` | ||
|
||
Step 3: Load your story elements and rules into the framework | ||
|
||
**Ver 0.5.0** | ||
* Update to Elm 0.17.0 (and other latest modules) | ||
* Upgrade starter code per [upgrade-docs](https://github.com/elm-lang/elm-platform/blob/master/upgrade-docs/0.17.md) | ||
* Remove `elm-hot-loader` (for now) | ||
```elm | ||
Story.load info elements scenes setup | ||
``` | ||
|
||
**Ver 0.4.0** | ||
* Add [elm-hot-loader](https://github.com/fluxxu/elm-hot-loader) for HMR support (PR by [fluxxu](https://github.com/fluxxu)) | ||
## Sample Stories | ||
|
||
**Ver 0.3.0** | ||
* Use `html-webpack-plugin` to generate `index.html` | ||
* Apply hash filenames for bundled JS and CSS (prevents caching) | ||
* Image and favicon assets copied to `dist/` | ||
* coming soon... |
Oops, something went wrong.