Browserify+Backbone+Marionette frontend enviroment
This slush aims to provide a plug and play MarionetteJS application.
Provides the following:
What needs to be done:
What does not include:
jadeify
.The idea of this slush is: write your app, execute gulp, (run tests) n see the results.
Install slush-marionette-frontend
globally:
npm install -g slush-marionette-frontend
Or directly from this github repo:
npm install -g woile/slush-marionette-frontend
You'll also need to have slush
and gulp
installed globally.
npm install -g gulp slush
If you don't have your node configure try using sudo
to install slush
and slush-marionette-frontend
.
The idea of this marionette application is to have the directory structure sorted by feature, look at this link for more information (I think it applies for marionette also), http://stackoverflow.com/questions/18542353/angularjs-folder-structure.
Every part of the application should be created inside components, reusable elements should be included inside the commons folder, like behaviors or related stuff.
The layout should be created in the src/components/layout
folder (duh).
The project structure with the contact-example included will look like this:
my-marionette-app
├── CHANGELOG
├── gulp-appfy/
│ ├── config.json
│ ├── index.js
│ └── tasks/
│ ├── browserify.js
│ ├── browser-sync.js
│ ├── build.js
│ ├── clean.js
│ ├── dev.js
│ ├── postcss.js
│ ├── serve.js
│ └── watch-files.js
├── gulpfile.js
├── index.html
├── npm-debug.log
├── package.json
├── README.md
└── src/
├── app.js
├── components
│ ├── commons
│ ├── layout
│ └── contact-example
│ ├── index.js
│ ├── contact.models.js
│ ├── contact.views.js
│ ├── contact.html
│ └── result.html
├── index.css
├── index.js
├── node_modules
├── routes.js
└── styles
Available generators:
Creates a new Marionette application, generating all the boilerplate you need to get started.
Create a new folder for your project:
mkdir my-marionette-app
Run the generator from within the new folder:
cd my-marionette-app
slush marionette-frontend
or
cd my-marionette-app
slush marionette-frontend:init
You will be prompted with some question related to you Marionette app.
Generates a module in src/components/<module>
Syntax:
slush marionette-frontend:module <moduleName>
Example:
slush marionette-frontend:module login
You will be prompted to give a name to your new Marionette module.
src/routes.js
should be defined the route inside appRoutes and its corresponding function inside the urlHandler.'Cannot read property 'Deferred' of undefined'
error, is used the backbone version that appears in the package.json, and Backbone.$
is setted in the src/app.js
. If you want to read more go to: https://github.com/thejameskyle/marionette-wires/issues/56, this should be fixed in the coming version of Marionette (I hope).Slush is a tool that uses Gulp for project scaffolding.
Slush does not contain anything "out of the box", except the ability to locate installed slush generators and to run them with liftoff.
To find out more about Slush, check out the documentation.
See the CONTRIBUTING Guidelines
If you have any problem or suggestion please open an issue here.
The MIT License
Copyright (c) 2015, Santiago
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.