├── .gitignore ├── .sailsrc ├── Gruntfile.js ├── README.md ├── api ├── policies │ └── sessionAuth.js └── responses │ ├── badRequest.js │ ├── forbidden.js │ ├── notFound.js │ └── serverError.js ├── app.js ├── assets ├── css │ ├── .gitkeep │ └── app.css ├── img │ └── .gitkeep ├── index-async.html ├── index-async.html.template ├── index.html ├── js │ ├── app.js │ ├── controllers.js │ ├── directives.js │ ├── filters.js │ └── services.js ├── lib │ └── angular │ │ ├── angular-animate.js │ │ ├── angular-animate.min.js │ │ ├── angular-animate.min.js.map │ │ ├── angular-cookies.js │ │ ├── angular-cookies.min.js │ │ ├── angular-cookies.min.js.map │ │ ├── angular-csp.css │ │ ├── angular-loader.js │ │ ├── angular-loader.min.js │ │ ├── angular-loader.min.js.map │ │ ├── angular-resource.js │ │ ├── angular-resource.min.js │ │ ├── angular-resource.min.js.map │ │ ├── angular-route.js │ │ ├── angular-route.min.js │ │ ├── angular-route.min.js.map │ │ ├── angular-sanitize.js │ │ ├── angular-sanitize.min.js │ │ ├── angular-sanitize.min.js.map │ │ ├── angular-scenario.js │ │ ├── angular-touch.js │ │ ├── angular-touch.min.js │ │ ├── angular-touch.min.js.map │ │ ├── angular.js │ │ ├── angular.min.js │ │ ├── angular.min.js.gzip │ │ ├── angular.min.js.map │ │ ├── errors.json │ │ ├── i18n │ │ ├── angular-locale_af-na.js │ │ ├── angular-locale_af-za.js │ │ ├── angular-locale_af.js │ │ ├── angular-locale_am-et.js │ │ ├── angular-locale_am.js │ │ ├── angular-locale_ar-001.js │ │ ├── angular-locale_ar-ae.js │ │ ├── angular-locale_ar-bh.js │ │ ├── angular-locale_ar-dz.js │ │ ├── angular-locale_ar-eg.js │ │ ├── angular-locale_ar-iq.js │ │ ├── angular-locale_ar-jo.js │ │ ├── angular-locale_ar-kw.js │ │ ├── angular-locale_ar-lb.js │ │ ├── angular-locale_ar-ly.js │ │ ├── angular-locale_ar-ma.js │ │ ├── angular-locale_ar-om.js │ │ ├── angular-locale_ar-qa.js │ │ ├── angular-locale_ar-sa.js │ │ ├── angular-locale_ar-sd.js │ │ ├── angular-locale_ar-sy.js │ │ ├── angular-locale_ar-tn.js │ │ ├── angular-locale_ar-ye.js │ │ ├── angular-locale_ar.js │ │ ├── angular-locale_bg-bg.js │ │ ├── angular-locale_bg.js │ │ ├── angular-locale_bn-bd.js │ │ ├── angular-locale_bn-in.js │ │ ├── angular-locale_bn.js │ │ ├── angular-locale_ca-ad.js │ │ ├── angular-locale_ca-es.js │ │ ├── angular-locale_ca.js │ │ ├── angular-locale_cs-cz.js │ │ ├── angular-locale_cs.js │ │ ├── angular-locale_da-dk.js │ │ ├── angular-locale_da.js │ │ ├── angular-locale_de-at.js │ │ ├── angular-locale_de-be.js │ │ ├── angular-locale_de-ch.js │ │ ├── angular-locale_de-de.js │ │ ├── angular-locale_de-li.js │ │ ├── angular-locale_de-lu.js │ │ ├── angular-locale_de.js │ │ ├── angular-locale_el-cy.js │ │ ├── angular-locale_el-gr.js │ │ ├── angular-locale_el.js │ │ ├── angular-locale_en-as.js │ │ ├── angular-locale_en-au.js │ │ ├── angular-locale_en-bb.js │ │ ├── angular-locale_en-be.js │ │ ├── angular-locale_en-bm.js │ │ ├── angular-locale_en-bw.js │ │ ├── angular-locale_en-bz.js │ │ ├── angular-locale_en-ca.js │ │ ├── angular-locale_en-dsrt-us.js │ │ ├── angular-locale_en-dsrt.js │ │ ├── angular-locale_en-fm.js │ │ ├── angular-locale_en-gb.js │ │ ├── angular-locale_en-gu.js │ │ ├── angular-locale_en-gy.js │ │ ├── angular-locale_en-hk.js │ │ ├── angular-locale_en-ie.js │ │ ├── angular-locale_en-in.js │ │ ├── angular-locale_en-iso.js │ │ ├── angular-locale_en-jm.js │ │ ├── angular-locale_en-mh.js │ │ ├── angular-locale_en-mp.js │ │ ├── angular-locale_en-mt.js │ │ ├── angular-locale_en-mu.js │ │ ├── angular-locale_en-na.js │ │ ├── angular-locale_en-nz.js │ │ ├── angular-locale_en-ph.js │ │ ├── angular-locale_en-pk.js │ │ ├── angular-locale_en-pr.js │ │ ├── angular-locale_en-pw.js │ │ ├── angular-locale_en-sg.js │ │ ├── angular-locale_en-tc.js │ │ ├── angular-locale_en-tt.js │ │ ├── angular-locale_en-um.js │ │ ├── angular-locale_en-us.js │ │ ├── angular-locale_en-vg.js │ │ ├── angular-locale_en-vi.js │ │ ├── angular-locale_en-za.js │ │ ├── angular-locale_en-zw.js │ │ ├── angular-locale_en.js │ │ ├── angular-locale_es-419.js │ │ ├── angular-locale_es-ar.js │ │ ├── angular-locale_es-bo.js │ │ ├── angular-locale_es-cl.js │ │ ├── angular-locale_es-co.js │ │ ├── angular-locale_es-cr.js │ │ ├── angular-locale_es-do.js │ │ ├── angular-locale_es-ea.js │ │ ├── angular-locale_es-ec.js │ │ ├── angular-locale_es-es.js │ │ ├── angular-locale_es-gq.js │ │ ├── angular-locale_es-gt.js │ │ ├── angular-locale_es-hn.js │ │ ├── angular-locale_es-ic.js │ │ ├── angular-locale_es-mx.js │ │ ├── angular-locale_es-ni.js │ │ ├── angular-locale_es-pa.js │ │ ├── angular-locale_es-pe.js │ │ ├── angular-locale_es-pr.js │ │ ├── angular-locale_es-py.js │ │ ├── angular-locale_es-sv.js │ │ ├── angular-locale_es-us.js │ │ ├── angular-locale_es-uy.js │ │ ├── angular-locale_es-ve.js │ │ ├── angular-locale_es.js │ │ ├── angular-locale_et-ee.js │ │ ├── angular-locale_et.js │ │ ├── angular-locale_eu-es.js │ │ ├── angular-locale_eu.js │ │ ├── angular-locale_fa-af.js │ │ ├── angular-locale_fa-ir.js │ │ ├── angular-locale_fa.js │ │ ├── angular-locale_fi-fi.js │ │ ├── angular-locale_fi.js │ │ ├── angular-locale_fil-ph.js │ │ ├── angular-locale_fil.js │ │ ├── angular-locale_fr-be.js │ │ ├── angular-locale_fr-bf.js │ │ ├── angular-locale_fr-bi.js │ │ ├── angular-locale_fr-bj.js │ │ ├── angular-locale_fr-bl.js │ │ ├── angular-locale_fr-ca.js │ │ ├── angular-locale_fr-cd.js │ │ ├── angular-locale_fr-cf.js │ │ ├── angular-locale_fr-cg.js │ │ ├── angular-locale_fr-ch.js │ │ ├── angular-locale_fr-ci.js │ │ ├── angular-locale_fr-cm.js │ │ ├── angular-locale_fr-dj.js │ │ ├── angular-locale_fr-fr.js │ │ ├── angular-locale_fr-ga.js │ │ ├── angular-locale_fr-gf.js │ │ ├── angular-locale_fr-gn.js │ │ ├── angular-locale_fr-gp.js │ │ ├── angular-locale_fr-gq.js │ │ ├── angular-locale_fr-km.js │ │ ├── angular-locale_fr-lu.js │ │ ├── angular-locale_fr-mc.js │ │ ├── angular-locale_fr-mf.js │ │ ├── angular-locale_fr-mg.js │ │ ├── angular-locale_fr-ml.js │ │ ├── angular-locale_fr-mq.js │ │ ├── angular-locale_fr-ne.js │ │ ├── angular-locale_fr-re.js │ │ ├── angular-locale_fr-yt.js │ │ ├── angular-locale_fr.js │ │ ├── angular-locale_gl-es.js │ │ ├── angular-locale_gl.js │ │ ├── angular-locale_gsw-ch.js │ │ ├── angular-locale_gsw.js │ │ ├── angular-locale_gu-in.js │ │ ├── angular-locale_gu.js │ │ ├── angular-locale_he-il.js │ │ ├── angular-locale_he.js │ │ ├── angular-locale_hi-in.js │ │ ├── angular-locale_hi.js │ │ ├── angular-locale_hr-hr.js │ │ ├── angular-locale_hr.js │ │ ├── angular-locale_hu-hu.js │ │ ├── angular-locale_hu.js │ │ ├── angular-locale_id-id.js │ │ ├── angular-locale_id.js │ │ ├── angular-locale_in.js │ │ ├── angular-locale_is-is.js │ │ ├── angular-locale_is.js │ │ ├── angular-locale_it-it.js │ │ ├── angular-locale_it-sm.js │ │ ├── angular-locale_it.js │ │ ├── angular-locale_iw.js │ │ ├── angular-locale_ja-jp.js │ │ ├── angular-locale_ja.js │ │ ├── angular-locale_kn-in.js │ │ ├── angular-locale_kn.js │ │ ├── angular-locale_ko-kr.js │ │ ├── angular-locale_ko.js │ │ ├── angular-locale_ln-cd.js │ │ ├── angular-locale_ln.js │ │ ├── angular-locale_lt-lt.js │ │ ├── angular-locale_lt.js │ │ ├── angular-locale_lv-lv.js │ │ ├── angular-locale_lv.js │ │ ├── angular-locale_ml-in.js │ │ ├── angular-locale_ml.js │ │ ├── angular-locale_mr-in.js │ │ ├── angular-locale_mr.js │ │ ├── angular-locale_ms-my.js │ │ ├── angular-locale_ms.js │ │ ├── angular-locale_mt-mt.js │ │ ├── angular-locale_mt.js │ │ ├── angular-locale_nl-cw.js │ │ ├── angular-locale_nl-nl.js │ │ ├── angular-locale_nl-sx.js │ │ ├── angular-locale_nl.js │ │ ├── angular-locale_no.js │ │ ├── angular-locale_or-in.js │ │ ├── angular-locale_or.js │ │ ├── angular-locale_pl-pl.js │ │ ├── angular-locale_pl.js │ │ ├── angular-locale_pt-br.js │ │ ├── angular-locale_pt-pt.js │ │ ├── angular-locale_pt.js │ │ ├── angular-locale_ro-ro.js │ │ ├── angular-locale_ro.js │ │ ├── angular-locale_ru-ru.js │ │ ├── angular-locale_ru.js │ │ ├── angular-locale_sk-sk.js │ │ ├── angular-locale_sk.js │ │ ├── angular-locale_sl-si.js │ │ ├── angular-locale_sl.js │ │ ├── angular-locale_sq-al.js │ │ ├── angular-locale_sq.js │ │ ├── angular-locale_sr-cyrl-rs.js │ │ ├── angular-locale_sr-latn-rs.js │ │ ├── angular-locale_sr.js │ │ ├── angular-locale_sv-se.js │ │ ├── angular-locale_sv.js │ │ ├── angular-locale_sw-tz.js │ │ ├── angular-locale_sw.js │ │ ├── angular-locale_ta-in.js │ │ ├── angular-locale_ta.js │ │ ├── angular-locale_te-in.js │ │ ├── angular-locale_te.js │ │ ├── angular-locale_th-th.js │ │ ├── angular-locale_th.js │ │ ├── angular-locale_tl.js │ │ ├── angular-locale_tr-tr.js │ │ ├── angular-locale_tr.js │ │ ├── angular-locale_uk-ua.js │ │ ├── angular-locale_uk.js │ │ ├── angular-locale_ur-pk.js │ │ ├── angular-locale_ur.js │ │ ├── angular-locale_vi-vn.js │ │ ├── angular-locale_vi.js │ │ ├── angular-locale_zh-cn.js │ │ ├── angular-locale_zh-hans-cn.js │ │ ├── angular-locale_zh-hk.js │ │ ├── angular-locale_zh-tw.js │ │ ├── angular-locale_zh.js │ │ ├── angular-locale_zu-za.js │ │ └── angular-locale_zu.js │ │ ├── version.json │ │ └── version.txt └── partials │ ├── .gitkeep │ ├── partial1.html │ └── partial2.html ├── config ├── blueprints.js ├── bootstrap.js ├── connections.js ├── cors.js ├── csrf.js ├── express.js ├── globals.js ├── i18n.js ├── locales │ ├── _README.md │ ├── de.json │ ├── en.json │ ├── es.json │ └── fr.json ├── log.js ├── models.js ├── policies.js ├── routes.js ├── session.js ├── sockets.js └── views.js ├── package.json ├── tasks ├── config │ ├── clean.js │ ├── coffee.js │ ├── concat.js │ ├── copy.js │ ├── cssmin.js │ ├── jst.js │ ├── less.js │ ├── sails-linker.js │ ├── sync.js │ ├── uglify.js │ └── watch.js ├── register │ ├── build.js │ ├── buildProd.js │ ├── compileAssets.js │ ├── default.js │ ├── linkAssets.js │ ├── linkAssetsBuild.js │ ├── linkAssetsBuildProd.js │ ├── prod.js │ └── syncAssets.js └── values │ └── injectedFiles.js └── views ├── 403.ejs ├── 404.ejs ├── 500.ejs ├── homepage.ejs └── layout.ejs /.sailsrc: -------------------------------------------------------------------------------- 1 | { 2 | "generators": { 3 | "modules": {} 4 | } 5 | } -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | var includeAll = require('sails/node_modules/include-all') 2 | , path = require('path'); 3 | 4 | /** 5 | * Gruntfile 6 | * 7 | * By default, the Gruntfile in new Sails projects comes with a `linker` 8 | * task, which will automatically inject client-side scripts, styles, and templates 9 | * from your `assets` folder into specific regions of certain EJS and HTML files 10 | * specified below. This behavior is completely optional, but here for convenience. 11 | * 12 | * At the top part of this file, you'll find a few of the most commonly 13 | * configured options, but Sails' integration with Grunt is also fully 14 | * customizable. If you'd like to work with your assets differently 15 | * you can change this file to do anything you like! 16 | * 17 | * More information on using Grunt to work with static assets: 18 | * http://gruntjs.com/configuring-tasks 19 | */ 20 | 21 | module.exports = function(grunt) { 22 | 23 | 24 | 25 | configureGruntfile(); 26 | 27 | /** 28 | * Load CommonJS submodules from the specified 29 | * relative path. 30 | * 31 | * @return {Object} 32 | */ 33 | function loadTasks (relPath) { 34 | return includeAll({ 35 | dirname: path.resolve(__dirname, relPath), 36 | filter: /(.+)\.js$/ 37 | }); 38 | } 39 | 40 | /** 41 | * Invokes the config function for the task config and register definitions. 42 | * Make sure to pass in grunt. 43 | * 44 | * @param {Object} tasks [Grunt object that each task will need] 45 | */ 46 | function invokeConfigFn (tasks) { 47 | for (var taskName in tasks) { 48 | if (tasks.hasOwnProperty(taskName)) { 49 | tasks[taskName](grunt); 50 | } 51 | } 52 | } 53 | 54 | /** 55 | * Configure the gruntfile. 56 | */ 57 | function configureGruntfile () { 58 | var taskConfigurations = loadTasks('./tasks/config'), 59 | registerDefinitions = loadTasks('./tasks/register'); 60 | 61 | invokeConfigFn(taskConfigurations); 62 | invokeConfigFn(registerDefinitions); 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular on Sails 2 | 3 | Just a plain 'ol skeleton v0.10 Sails app with [Angular Seed](https://github.com/angular/angular-seed) in the assets folder, layout.ejs and homepage.ejs. 4 | -------------------------------------------------------------------------------- /api/policies/sessionAuth.js: -------------------------------------------------------------------------------- 1 | /** 2 | * sessionAuth 3 | * 4 | * @module :: Policy 5 | * @description :: Simple policy to allow any authenticated user 6 | * Assumes that your login action in one of your controllers sets `req.session.authenticated = true;` 7 | * @docs :: http://sailsjs.org/#!documentation/policies 8 | * 9 | */ 10 | module.exports = function(req, res, next) { 11 | 12 | // User is allowed, proceed to the next policy, 13 | // or if this is the last policy, the controller 14 | if (req.session.authenticated) { 15 | return next(); 16 | } 17 | 18 | // User is not allowed 19 | // (default res.forbidden() behavior can be overridden in `config/403.js`) 20 | return res.forbidden('You are not permitted to perform this action.'); 21 | }; 22 | -------------------------------------------------------------------------------- /api/responses/forbidden.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 403 (Forbidden) Handler 3 | * 4 | * Usage: 5 | * return res.forbidden('Access denied.'); 6 | * 7 | * @param {String|Object|Array} message 8 | * optional message to inject into view locals or JSON response 9 | * 10 | */ 11 | 12 | module.exports = function forbidden(message) { 13 | 14 | // Get access to `req` and `res` 15 | var req = this.req; 16 | var res = this.res; 17 | 18 | var viewFilePath = '403'; 19 | var statusCode = 403; 20 | 21 | var result = { 22 | status: statusCode 23 | }; 24 | 25 | // Optional message 26 | if (message) { 27 | result.message = message; 28 | } 29 | 30 | // If the user-agent wants a JSON response, send json 31 | if (req.wantsJSON) { 32 | return res.json(result, result.status); 33 | } 34 | 35 | // Set status code and view locals 36 | res.status(result.status); 37 | for (var key in result) { 38 | res.locals[key] = result[key]; 39 | } 40 | // And render view 41 | res.render(viewFilePath, result, function(err) { 42 | // If the view doesn't exist, or an error occured, send json 43 | if (err) { 44 | return res.json(result, result.status); 45 | } 46 | 47 | // Otherwise, serve the `views/403.*` page 48 | res.render(viewFilePath); 49 | }); 50 | }; 51 | -------------------------------------------------------------------------------- /api/responses/notFound.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 404 (Not Found) Handler 3 | * 4 | * Usage: 5 | * return res.notFound(); 6 | * 7 | * NOTE: 8 | * If no user-defined route, blueprint route, or static file matches 9 | * the requested URL, Sails will call `res.notFound()`. 10 | */ 11 | 12 | module.exports = function notFound() { 13 | 14 | // Get access to `req` and `res` 15 | var req = this.req; 16 | var res = this.res; 17 | 18 | var viewFilePath = '404'; 19 | var statusCode = 404; 20 | var result = { 21 | status: statusCode 22 | }; 23 | 24 | // If the user-agent wants a JSON response, send json 25 | if (req.wantsJSON) { 26 | return res.json(result, result.status); 27 | } 28 | 29 | res.status(result.status); 30 | res.render(viewFilePath, function(err) { 31 | // If the view doesn't exist, or an error occured, send json 32 | if (err) { 33 | return res.json(result, result.status); 34 | } 35 | 36 | // Otherwise, serve the `views/404.*` page 37 | res.render(viewFilePath); 38 | }); 39 | }; 40 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * app.js 3 | * 4 | * Use `app.js` to run your app without `sails lift`. 5 | * To start the server, run: `node app.js`. 6 | * 7 | * This is handy in situations where the sails CLI is not relevant or useful. 8 | * 9 | * For example: 10 | * => `node app.js` 11 | * => `forever start app.js` 12 | * => `node debug app.js` 13 | * => `modulus deploy` 14 | * => `heroku scale` 15 | * 16 | * 17 | * The same command-line arguments are supported, e.g.: 18 | * `node app.js --silent --port=80 --prod` 19 | */ 20 | 21 | // Ensure a "sails" can be located: 22 | var sails; 23 | try { 24 | sails = require('sails'); 25 | } 26 | catch (e) { 27 | console.error('To run an app using `node app.js`, you usually need to have a version of `sails` installed in the same directory as your app.'); 28 | console.error('To do that, run `npm install sails`'); 29 | console.error(''); 30 | console.error('Alternatively, if you have sails installed globally (i.e. you did `npm install -g sails`), you can use `sails lift`.'); 31 | console.error('When you run `sails lift`, your app will still use a local `./node_modules/sails` dependency if it exists,'); 32 | console.error('but if it doesn\'t, the app will run with the global sails instead!'); 33 | return; 34 | } 35 | 36 | // Start server 37 | sails.lift(); 38 | -------------------------------------------------------------------------------- /assets/css/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sgress454/angular-on-sails/38e11acdb46d4a6ac8bde355c102e78449fee154/assets/css/.gitkeep -------------------------------------------------------------------------------- /assets/css/app.css: -------------------------------------------------------------------------------- 1 | /* app css stylesheet */ 2 | 3 | .menu { 4 | list-style: none; 5 | border-bottom: 0.1em solid black; 6 | margin-bottom: 2em; 7 | padding: 0 0 0.5em; 8 | } 9 | 10 | .menu:before { 11 | content: "["; 12 | } 13 | 14 | .menu:after { 15 | content: "]"; 16 | } 17 | 18 | .menu > li { 19 | display: inline; 20 | } 21 | 22 | .menu > li:before { 23 | content: "|"; 24 | padding-right: 0.3em; 25 | } 26 | 27 | .menu > li:nth-child(1):before { 28 | content: ""; 29 | padding: 0; 30 | } 31 | -------------------------------------------------------------------------------- /assets/img/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sgress454/angular-on-sails/38e11acdb46d4a6ac8bde355c102e78449fee154/assets/img/.gitkeep -------------------------------------------------------------------------------- /assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | My AngularJS App 6 | 7 | 8 | 9 | 13 | 14 |
15 | 16 |
Angular seed app: v
17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /assets/js/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | // Declare app level module which depends on filters, and services 5 | angular.module('myApp', [ 6 | 'ngRoute', 7 | 'myApp.filters', 8 | 'myApp.services', 9 | 'myApp.directives', 10 | 'myApp.controllers' 11 | ]). 12 | config(['$routeProvider', function($routeProvider) { 13 | $routeProvider.when('/view1', {templateUrl: 'partials/partial1.html', controller: 'MyCtrl1'}); 14 | $routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: 'MyCtrl2'}); 15 | $routeProvider.otherwise({redirectTo: '/view1'}); 16 | }]); 17 | -------------------------------------------------------------------------------- /assets/js/controllers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Controllers */ 4 | 5 | angular.module('myApp.controllers', []). 6 | controller('MyCtrl1', [function() { 7 | 8 | }]) 9 | .controller('MyCtrl2', [function() { 10 | 11 | }]); -------------------------------------------------------------------------------- /assets/js/directives.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Directives */ 4 | 5 | 6 | angular.module('myApp.directives', []). 7 | directive('appVersion', ['version', function(version) { 8 | return function(scope, elm, attrs) { 9 | elm.text(version); 10 | }; 11 | }]); 12 | -------------------------------------------------------------------------------- /assets/js/filters.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Filters */ 4 | 5 | angular.module('myApp.filters', []). 6 | filter('interpolate', ['version', function(version) { 7 | return function(text) { 8 | return String(text).replace(/\%VERSION\%/mg, version); 9 | } 10 | }]); 11 | -------------------------------------------------------------------------------- /assets/js/services.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Services */ 4 | 5 | 6 | // Demonstrate how to register services 7 | // In this case it is a simple value service. 8 | angular.module('myApp.services', []). 9 | value('version', '0.1'); 10 | -------------------------------------------------------------------------------- /assets/lib/angular/angular-cookies.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.13 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(p,f,n){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(d,b){var c={},g={},h,k=!1,l=f.copy,m=f.isUndefined;b.addPollFn(function(){var a=b.cookies();h!=a&&(h=a,l(a,g),l(a,c),k&&d.$apply())})();k=!0;d.$watch(function(){var a,e,d;for(a in g)m(c[a])&&b.cookies(a,n);for(a in c)(e=c[a],f.isString(e))?e!==g[a]&&(b.cookies(a,e),d=!0):f.isDefined(g[a])?c[a]=g[a]:delete c[a];if(d)for(a in e=b.cookies(),c)c[a]!==e[a]&&(m(e[a])?delete c[a]:c[a]=e[a])}); 7 | return c}]).factory("$cookieStore",["$cookies",function(d){return{get:function(b){return(b=d[b])?f.fromJson(b):b},put:function(b,c){d[b]=f.toJson(c)},remove:function(b){delete d[b]}}}])})(window,window.angular); 8 | //# sourceMappingURL=angular-cookies.min.js.map 9 | -------------------------------------------------------------------------------- /assets/lib/angular/angular-cookies.min.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"angular-cookies.min.js", 4 | "lineCount":7, 5 | "mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAoBtCD,CAAAE,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,QAAA,CA4BW,UA5BX,CA4BuB,CAAC,YAAD,CAAe,UAAf,CAA2B,QAAS,CAACC,CAAD,CAAaC,CAAb,CAAuB,CAAA,IACxEC,EAAU,EAD8D,CAExEC,EAAc,EAF0D,CAGxEC,CAHwE,CAIxEC,EAAU,CAAA,CAJ8D,CAKxEC,EAAOV,CAAAU,KALiE,CAMxEC,EAAcX,CAAAW,YAGlBN,EAAAO,UAAA,CAAmB,QAAQ,EAAG,CAC5B,IAAIC,EAAiBR,CAAAC,QAAA,EACjBE,EAAJ,EAA0BK,CAA1B,GACEL,CAGA,CAHqBK,CAGrB,CAFAH,CAAA,CAAKG,CAAL,CAAqBN,CAArB,CAEA,CADAG,CAAA,CAAKG,CAAL,CAAqBP,CAArB,CACA,CAAIG,CAAJ,EAAaL,CAAAU,OAAA,EAJf,CAF4B,CAA9B,CAAA,EAUAL,EAAA,CAAU,CAAA,CAKVL,EAAAW,OAAA,CASAC,QAAa,EAAG,CAAA,IACVC,CADU,CAEVC,CAFU,CAIVC,CAGJ,KAAKF,CAAL,GAAaV,EAAb,CACMI,CAAA,CAAYL,CAAA,CAAQW,CAAR,CAAZ,CAAJ,EACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBhB,CAAvB,CAKJ,KAAIgB,CAAJ,GAAYX,EAAZ,CAEE,CADAY,CACK,CADGZ,CAAA,CAAQW,CAAR,CACH,CAAAjB,CAAAoB,SAAA,CAAiBF,CAAjB,CAAL,EAMWA,CANX,GAMqBX,CAAA,CAAYU,CAAZ,CANrB,GAOEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBC,CAAvB,CACA,CAAAC,CAAA,CAAU,CAAA,CARZ,EACMnB,CAAAqB,UAAA,CAAkBd,CAAA,CAAYU,CAAZ,CAAlB,CAAJ,CACEX,CAAA,CAAQW,CAAR,CADF,CACkBV,CAAA,CAAYU,CAAZ,CADlB,CAGE,OAAOX,CAAA,CAAQW,CAAR,CASb,IAAIE,CAAJ,CAIE,IAAKF,CAAL,GAFAK,EAEahB,CAFID,CAAAC,QAAA,EAEJA,CAAAA,CAAb,CACMA,CAAA,CAAQW,CAAR,CAAJ,GAAsBK,CAAA,CAAeL,CAAf,CAAtB,GAEMN,CAAA,CAAYW,CAAA,CAAeL,CAAf,CAAZ,CAAJ,CACE,OAAOX,CAAA,CAAQW,CAAR,CADT,CAGEX,CAAA,CAAQW,CAAR,CAHF,CAGkBK,CAAA,CAAeL,CAAf,CALpB,CAlCU,CAThB,CAEA;MAAOX,EA1BqE,CAA3D,CA5BvB,CAAAH,QAAA,CA4HW,cA5HX,CA4H2B,CAAC,UAAD,CAAa,QAAQ,CAACoB,CAAD,CAAW,CAErD,MAAO,KAYAC,QAAQ,CAACC,CAAD,CAAM,CAEjB,MAAO,CADHP,CACG,CADKK,CAAA,CAASE,CAAT,CACL,EAAQzB,CAAA0B,SAAA,CAAiBR,CAAjB,CAAR,CAAkCA,CAFxB,CAZd,KA4BAS,QAAQ,CAACF,CAAD,CAAMP,CAAN,CAAa,CACxBK,CAAA,CAASE,CAAT,CAAA,CAAgBzB,CAAA4B,OAAA,CAAeV,CAAf,CADQ,CA5BrB,QA0CGW,QAAQ,CAACJ,CAAD,CAAM,CACpB,OAAOF,CAAA,CAASE,CAAT,CADa,CA1CjB,CAF8C,CAAhC,CA5H3B,CApBsC,CAArC,CAAA,CAoME1B,MApMF,CAoMUA,MAAAC,QApMV;", 6 | "sources":["angular-cookies.js"], 7 | "names":["window","angular","undefined","module","factory","$rootScope","$browser","cookies","lastCookies","lastBrowserCookies","runEval","copy","isUndefined","addPollFn","currentCookies","$apply","$watch","push","name","value","updated","isString","isDefined","browserCookies","$cookies","get","key","fromJson","put","toJson","remove"] 8 | } 9 | -------------------------------------------------------------------------------- /assets/lib/angular/angular-csp.css: -------------------------------------------------------------------------------- 1 | /* Include this file in your html if you are using the CSP mode. */ 2 | 3 | @charset "UTF-8"; 4 | 5 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], 6 | .ng-cloak, .x-ng-cloak, 7 | .ng-hide { 8 | display: none !important; 9 | } 10 | 11 | ng\:form { 12 | display: block; 13 | } 14 | 15 | .ng-animate-block-transitions { 16 | transition:0s all!important; 17 | -webkit-transition:0s all!important; 18 | } 19 | -------------------------------------------------------------------------------- /assets/lib/angular/angular-loader.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.13 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(){'use strict';function d(a){return function(){var c=arguments[0],b,c="["+(a?a+":":"")+c+"] http://errors.angularjs.org/1.2.13/"+(a?a+"/":"")+c;for(b=1;bThis is the partial for view 1.

2 | -------------------------------------------------------------------------------- /assets/partials/partial2.html: -------------------------------------------------------------------------------- 1 |

This is the partial for view 2.

2 |

3 | Showing of 'interpolate' filter: 4 | {{ 'Current version is v%VERSION%.' | interpolate }} 5 |

6 | -------------------------------------------------------------------------------- /config/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Bootstrap 3 | * 4 | * An asynchronous bootstrap function that runs before your Sails app gets lifted. 5 | * This gives you an opportunity to set up your data model, run jobs, or perform some special logic. 6 | * 7 | * For more information on bootstrapping your app, check out: 8 | * http://sailsjs.org/#documentation 9 | */ 10 | 11 | module.exports.bootstrap = function (cb) { 12 | 13 | // It's very important to trigger this callack method when you are finished 14 | // with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap) 15 | cb(); 16 | }; -------------------------------------------------------------------------------- /config/cors.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Cross-Origin Resource Sharing (CORS) 3 | * 4 | * CORS is like a more modern version of JSONP-- it allows your server/API 5 | * to successfully respond to requests from client-side JavaScript code 6 | * running on some other domain (e.g. google.com) 7 | * Unlike JSONP, it works with POST, PUT, and DELETE requests 8 | * 9 | * For more information on CORS, check out: 10 | * http://en.wikipedia.org/wiki/Cross-origin_resource_sharing 11 | * 12 | * Note that any of these settings (besides 'allRoutes') can be changed on a per-route basis 13 | * by adding a "cors" object to the route configuration: 14 | * 15 | * '/get foo': { 16 | * controller: 'foo', 17 | * action: 'bar', 18 | * cors: { 19 | * origin: 'http://foobar.com,https://owlhoot.com' 20 | * } 21 | * } 22 | * 23 | */ 24 | 25 | module.exports.cors = { 26 | 27 | // Allow CORS on all routes by default? If not, you must enable CORS on a 28 | // per-route basis by either adding a "cors" configuration object 29 | // to the route config, or setting "cors:true" in the route config to 30 | // use the default settings below. 31 | allRoutes: false, 32 | 33 | // Which domains which are allowed CORS access? 34 | // This can be a comma-delimited list of hosts (beginning with http:// or https://) 35 | // or "*" to allow all domains CORS access. 36 | origin: '*', 37 | 38 | // Allow cookies to be shared for CORS requests? 39 | credentials: true, 40 | 41 | // Which methods should be allowed for CORS requests? This is only used 42 | // in response to preflight requests (see article linked above for more info) 43 | methods: 'GET, POST, PUT, DELETE, OPTIONS, HEAD', 44 | 45 | // Which headers should be allowed for CORS requests? This is only used 46 | // in response to preflight requests. 47 | headers: 'content-type' 48 | 49 | }; -------------------------------------------------------------------------------- /config/csrf.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Cross-Site Request Forgery Protection 3 | * 4 | * CSRF tokens are like a tracking chip. While a session tells the server that a user 5 | * "is who they say they are", a csrf token tells the server "you are where you say you are". 6 | * 7 | * When enabled, all non-GET requests to the Sails server must be accompanied by 8 | * a special token, identified as the '_csrf' parameter. 9 | * 10 | * This option protects your Sails app against cross-site request forgery (or CSRF) attacks. 11 | * A would-be attacker needs not only a user's session cookie, but also this timestamped, 12 | * secret CSRF token, which is refreshed/granted when the user visits a URL on your app's domain. 13 | * 14 | * This allows us to have certainty that our users' requests haven't been hijacked, 15 | * and that the requests they're making are intentional and legitimate. 16 | * 17 | * This token has a short-lived expiration timeline, and must be acquired by either: 18 | * 19 | * (a) For traditional view-driven web apps: 20 | * Fetching it from one of your views, where it may be accessed as 21 | * a local variable, e.g.: 22 | *
23 | * 24 | *
25 | * 26 | * or (b) For AJAX/Socket-heavy and/or single-page apps: 27 | * Sending a GET request to the `/csrfToken` route, where it will be returned 28 | * as JSON, e.g.: 29 | * { _csrf: 'ajg4JD(JGdajhLJALHDa' } 30 | * 31 | * 32 | * Enabling this option requires managing the token in your front-end app. 33 | * For traditional web apps, it's as easy as passing the data from a view into a form action. 34 | * In AJAX/Socket-heavy apps, just send a GET request to the /csrfToken route to get a valid token. 35 | * 36 | * For more information on CSRF, check out: 37 | * http://en.wikipedia.org/wiki/Cross-site_request_forgery 38 | */ 39 | 40 | module.exports.csrf = false; -------------------------------------------------------------------------------- /config/globals.js: -------------------------------------------------------------------------------- 1 | module.exports.globals = { 2 | _: true, 3 | async: true, 4 | sails: true, 5 | services: true, 6 | models: true 7 | }; 8 | -------------------------------------------------------------------------------- /config/i18n.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Internationalization / Localization Settings 3 | * 4 | * If your app will touch people from all over the world, i18n (or internationalization) 5 | * may be an important part of your international strategy. 6 | * 7 | * 8 | * For more information, check out: 9 | * http://sailsjs.org/#documentation 10 | */ 11 | 12 | module.exports.i18n = { 13 | 14 | // Which locales are supported? 15 | locales: ['en', 'es', 'fr', 'de'] 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /config/locales/_README.md: -------------------------------------------------------------------------------- 1 | # Internationalization / Localization Settings 2 | 3 | ## Locale 4 | All locale files live under `config/locales`. Here is where you can add locale data as JSON key-value pairs. The name of the file should match the language that you are supporting, which allows for automatic language detection based on the user request. 5 | 6 | Here is an example locale stringfile for the Spanish language (`config/locales/es.json`): 7 | ```json 8 | { 9 | "Hello!": "Hola!", 10 | "Hello %s, how are you today?": "¿Hola %s, como estas?", 11 | } 12 | ``` 13 | ## Usage 14 | Locales can be accessed in controllers/policies through `res.i18n()`, or in views through the `__(key)` or `i18n(key)` functions. 15 | Remember that the keys are case sensitive and require exact key matches, e.g. 16 | 17 | ```ejs 18 |

<%= __('Welcome to PencilPals!') %>

19 |

<%= i18n('Hello %s, how are you today?', 'Pencil Maven') %>

20 |

<%= i18n('That\'s right-- you can use either i18n() or __()') %>

21 | ``` 22 | 23 | ## Configuration 24 | Localization/internationalization config can be found in `config/i18n.js`, from where you can set your supported locales. -------------------------------------------------------------------------------- /config/locales/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Wilkommen" 3 | } -------------------------------------------------------------------------------- /config/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Welcome" 3 | } 4 | -------------------------------------------------------------------------------- /config/locales/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Bienvenido" 3 | } 4 | -------------------------------------------------------------------------------- /config/locales/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "Welcome": "Bienvenue" 3 | } 4 | -------------------------------------------------------------------------------- /config/log.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Logger configuration 3 | * 4 | * Configure the log level for your app, as well as the transport 5 | * (Underneath the covers, Sails uses Winston for logging, which 6 | * allows for some pretty neat custom transports/adapters for log messages) 7 | * 8 | * For more information on the Sails logger, check out: 9 | * http://sailsjs.org/#documentation 10 | */ 11 | 12 | module.exports = { 13 | 14 | // Valid `level` configs: 15 | // i.e. the minimum log level to capture with sails.log.*() 16 | // 17 | // 'error' : Display calls to `.error()` 18 | // 'warn' : Display calls from `.error()` to `.warn()` 19 | // 'debug' : Display calls from `.error()`, `.warn()` to `.debug()` 20 | // 'info' : Display calls from `.error()`, `.warn()`, `.debug()` to `.info()` 21 | // 'verbose': Display calls from `.error()`, `.warn()`, `.debug()`, `.info()` to `.verbose()` 22 | // 23 | log: { 24 | level: 'info' 25 | } 26 | 27 | }; 28 | -------------------------------------------------------------------------------- /config/models.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Models 3 | * (sails.config.models) 4 | * 5 | * Unless you override them, the following properties will be included 6 | * in each of your models. 7 | */ 8 | 9 | module.exports.models = { 10 | 11 | // Your app's default connection. 12 | // i.e. the name of one of your app's connections (see `config/connections.js`) 13 | // 14 | // (defaults to localDiskDb) 15 | connection: 'localDiskDb' 16 | }; 17 | -------------------------------------------------------------------------------- /config/routes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Routes 3 | * 4 | * Your routes map URLs to views and controllers. 5 | * 6 | * If Sails receives a URL that doesn't match any of the routes below, 7 | * it will check for matching files (images, scripts, stylesheets, etc.) 8 | * in your assets directory. e.g. `http://localhost:1337/images/foo.jpg` 9 | * might match an image file: `/assets/images/foo.jpg` 10 | * 11 | * Finally, if those don't match either, the default 404 handler is triggered. 12 | * See `config/404.js` to adjust your app's 404 logic. 13 | * 14 | * Note: Sails doesn't ACTUALLY serve stuff from `assets`-- the default Gruntfile in Sails copies 15 | * flat files from `assets` to `.tmp/public`. This allows you to do things like compile LESS or 16 | * CoffeeScript for the front-end. 17 | * 18 | * For more information on routes, check out: 19 | * http://sailsjs.org/#documentation 20 | */ 21 | 22 | module.exports.routes = { 23 | 24 | 25 | // Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, etc. depending on your 26 | // default view engine) your home page. 27 | // 28 | // (Alternatively, remove this and add an `index.html` file in your `assets` directory) 29 | '/': { 30 | view: 'homepage' 31 | }, 32 | 33 | 34 | // Custom routes here... 35 | 36 | 37 | // If a request to a URL doesn't match any of the custom routes above, it is matched 38 | // against Sails route blueprints. See `config/blueprints.js` for configuration options 39 | // and examples. 40 | 41 | }; 42 | -------------------------------------------------------------------------------- /config/session.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Session 3 | * 4 | * Sails session integration leans heavily on the great work already done by Express, but also unifies 5 | * Socket.io with the Connect session store. It uses Connect's cookie parser to normalize configuration 6 | * differences between Express and Socket.io and hooks into Sails' middleware interpreter to allow you 7 | * to access and auto-save to `req.session` with Socket.io the same way you would with Express. 8 | * 9 | * For more information on configuring the session, check out: 10 | * http://sailsjs.org/#documentation 11 | */ 12 | 13 | module.exports.session = { 14 | 15 | // Session secret is automatically generated when your new app is created 16 | // Replace at your own risk in production-- you will invalidate the cookies of your users, 17 | // forcing them to log in again. 18 | secret: '957f7f7f30028d5029c7f0c7f087722c', 19 | 20 | 21 | // Set the session cookie expire time 22 | // The maxAge is set by milliseconds, the example below is for 24 hours 23 | // 24 | // cookie: { 25 | // maxAge: 24 * 60 * 60 * 1000 26 | // } 27 | 28 | 29 | // In production, uncomment the following lines to set up a shared redis session store 30 | // that can be shared across multiple Sails.js servers 31 | // adapter: 'redis', 32 | // 33 | // The following values are optional, if no options are set a redis instance running 34 | // on localhost is expected. 35 | // Read more about options at: https://github.com/visionmedia/connect-redis 36 | // 37 | // host: 'localhost', 38 | // port: 6379, 39 | // ttl: , 40 | // db: 0, 41 | // pass: 42 | // prefix: 'sess:' 43 | 44 | 45 | // Uncomment the following lines to use your Mongo adapter as a session store 46 | // adapter: 'mongo', 47 | // 48 | // host: 'localhost', 49 | // port: 27017, 50 | // db: 'sails', 51 | // collection: 'sessions', 52 | // 53 | // Optional Values: 54 | // 55 | // # Note: url will override other connection settings 56 | // url: 'mongodb://user:pass@host:port/database/collection', 57 | // 58 | // username: '', 59 | // password: '', 60 | // auto_reconnect: false, 61 | // ssl: false, 62 | // stringify: true 63 | 64 | }; 65 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testangular", 3 | "private": true, 4 | "version": "0.0.0", 5 | "description": "a Sails application", 6 | "keywords": [], 7 | "dependencies": { 8 | "sails": "~0.10.0-rc3", 9 | "sails-disk": "~0.10.0", 10 | "ejs": "~0.8.4", 11 | "grunt": "0.4.2", 12 | "grunt-sync": "~0.0.4", 13 | "grunt-contrib-copy": "~0.4.1", 14 | "grunt-contrib-clean": "~0.4.1", 15 | "grunt-contrib-concat": "~0.3.0", 16 | "grunt-sails-linker": "~0.9.5", 17 | "grunt-contrib-jst": "~0.5.0", 18 | "grunt-contrib-watch": "~0.4.4", 19 | "grunt-contrib-uglify": "~0.2.2", 20 | "grunt-contrib-cssmin": "~0.6.1", 21 | "grunt-contrib-less": "~0.9.0", 22 | "grunt-contrib-coffee": "~0.7.0" 23 | }, 24 | "scripts": { 25 | "start": "node app.js", 26 | "debug": "node debug app.js" 27 | }, 28 | "main": "app.js", 29 | "repository": { 30 | "type": "git", 31 | "url": "git://github.com/scottmac/testangular.git" 32 | }, 33 | "author": "scottmac", 34 | "license": "" 35 | } -------------------------------------------------------------------------------- /tasks/config/clean.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('clean', { 4 | dev: ['.tmp/public/**'], 5 | build: ['www'] 6 | }); 7 | 8 | grunt.loadNpmTasks('grunt-contrib-clean'); 9 | }; 10 | -------------------------------------------------------------------------------- /tasks/config/coffee.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('coffee', { 4 | dev: { 5 | options: { 6 | bare: true, 7 | sourceMap: true, 8 | sourceRoot: './' 9 | }, 10 | files: [{ 11 | expand: true, 12 | cwd: 'assets/js/', 13 | src: ['**/*.coffee'], 14 | dest: '.tmp/public/js/', 15 | ext: '.js' 16 | }, { 17 | expand: true, 18 | cwd: 'assets/js/', 19 | src: ['**/*.coffee'], 20 | dest: '.tmp/public/js/', 21 | ext: '.js' 22 | }] 23 | } 24 | }); 25 | 26 | grunt.loadNpmTasks('grunt-contrib-coffee'); 27 | }; 28 | -------------------------------------------------------------------------------- /tasks/config/concat.js: -------------------------------------------------------------------------------- 1 | var injectedFiles = require('../values/injectedFiles'); 2 | 3 | module.exports = function(grunt) { 4 | 5 | grunt.config.set('concat', { 6 | js: { 7 | src: injectedFiles.jsFilesToInject, 8 | dest: '.tmp/public/concat/production.js' 9 | }, 10 | css: { 11 | src: injectedFiles.cssFilesToInject, 12 | dest: '.tmp/public/concat/production.css' 13 | } 14 | }); 15 | 16 | grunt.loadNpmTasks('grunt-contrib-concat'); 17 | }; 18 | -------------------------------------------------------------------------------- /tasks/config/copy.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('copy', { 4 | dev: { 5 | files: [{ 6 | expand: true, 7 | cwd: './assets', 8 | src: ['**/*.!(coffee|less)'], 9 | dest: '.tmp/public' 10 | }] 11 | }, 12 | build: { 13 | files: [{ 14 | expand: true, 15 | cwd: '.tmp/public', 16 | src: ['**/*'], 17 | dest: 'www' 18 | }] 19 | } 20 | }); 21 | 22 | grunt.loadNpmTasks('grunt-contrib-copy'); 23 | }; 24 | -------------------------------------------------------------------------------- /tasks/config/cssmin.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('cssmin', { 4 | dist: { 5 | src: ['.tmp/public/concat/production.css'], 6 | dest: '.tmp/public/min/production.css' 7 | } 8 | }); 9 | 10 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/config/jst.js: -------------------------------------------------------------------------------- 1 | var injectedFiles = require('../values/injectedFiles'); 2 | 3 | module.exports = function(grunt) { 4 | 5 | var templateFilesToInject = [ 6 | 'templates/**/*.html' 7 | ]; 8 | 9 | grunt.config.set('jst', { 10 | dev: { 11 | 12 | // To use other sorts of templates, specify the regexp below: 13 | // options: { 14 | // templateSettings: { 15 | // interpolate: /\{\{(.+?)\}\}/g 16 | // } 17 | // }, 18 | 19 | files: { 20 | '.tmp/public/jst.js': injectedFiles.templateFilesToInject 21 | } 22 | } 23 | }); 24 | 25 | grunt.loadNpmTasks('grunt-contrib-jst'); 26 | }; 27 | -------------------------------------------------------------------------------- /tasks/config/less.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('less', { 4 | dev: { 5 | files: [{ 6 | expand: true, 7 | cwd: 'assets/styles/', 8 | src: ['*.less'], 9 | dest: '.tmp/public/styles/', 10 | ext: '.css' 11 | }] 12 | } 13 | }); 14 | 15 | grunt.loadNpmTasks('grunt-contrib-less'); 16 | }; 17 | -------------------------------------------------------------------------------- /tasks/config/sync.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('sync', { 4 | dev: { 5 | files: [{ 6 | cwd: './assets', 7 | src: ['**/*.!(coffee)'], 8 | dest: '.tmp/public' 9 | }] 10 | } 11 | }); 12 | 13 | grunt.loadNpmTasks('grunt-sync'); 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/config/uglify.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('uglify', { 4 | dist: { 5 | src: ['.tmp/public/concat/production.js'], 6 | dest: '.tmp/public/min/production.js' 7 | } 8 | }); 9 | 10 | grunt.loadNpmTasks('grunt-contrib-uglify'); 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/config/watch.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.config.set('watch', { 4 | api: { 5 | 6 | // API files to watch: 7 | files: ['api/**/*'] 8 | }, 9 | assets: { 10 | 11 | // Assets to watch: 12 | files: ['assets/**/*'], 13 | 14 | // When assets are changed: 15 | tasks: ['syncAssets' , 'linkAssets'] 16 | } 17 | }); 18 | 19 | grunt.loadNpmTasks('grunt-contrib-watch'); 20 | }; 21 | -------------------------------------------------------------------------------- /tasks/register/build.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('build', [ 3 | 'compileAssets', 4 | 'linkAssetsBuild', 5 | 'clean:build', 6 | 'copy:build' 7 | ]); 8 | }; 9 | -------------------------------------------------------------------------------- /tasks/register/buildProd.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('buildProd', [ 3 | 'compileAssets', 4 | 'concat', 5 | 'uglify', 6 | 'cssmin', 7 | 'linkAssetsBuildProd', 8 | 'clean:build', 9 | 'copy:build' 10 | ]); 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/register/compileAssets.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('compileAssets', [ 3 | 'clean:dev', 4 | 'jst:dev', 5 | 'less:dev', 6 | 'copy:dev', 7 | 'coffee:dev' 8 | ]); 9 | }; 10 | -------------------------------------------------------------------------------- /tasks/register/default.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('default', ['compileAssets', 'linkAssets', 'watch']); 3 | }; 4 | -------------------------------------------------------------------------------- /tasks/register/linkAssets.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('linkAssets', [ 3 | 'sails-linker:devJs', 4 | 'sails-linker:devStyles', 5 | 'sails-linker:devTpl' 6 | ]); 7 | }; 8 | -------------------------------------------------------------------------------- /tasks/register/linkAssetsBuild.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('linkAssetsBuild', [ 3 | 'sails-linker:devJsRelative', 4 | 'sails-linker:devStylesRelative', 5 | 'sails-linker:devTpl' 6 | ]); 7 | }; 8 | -------------------------------------------------------------------------------- /tasks/register/linkAssetsBuildProd.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('linkAssetsBuildProd', [ 3 | 'sails-linker:prodJsRelative', 4 | 'sails-linker:prodStylesRelative', 5 | 'sails-linker:devTpl' 6 | ]); 7 | }; 8 | -------------------------------------------------------------------------------- /tasks/register/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('prod', [ 3 | 'compileAssets', 4 | 'concat', 5 | 'uglify', 6 | 'cssmin', 7 | 'sails-linker:prodJs', 8 | 'sails-linker:prodStyles', 9 | 'sails-linker:devTpl' 10 | ]); 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/register/syncAssets.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.registerTask('syncAssets', [ 3 | 'jst:dev', 4 | 'less:dev', 5 | 'sync:dev', 6 | 'coffee:dev' 7 | ]); 8 | }; 9 | -------------------------------------------------------------------------------- /tasks/values/injectedFiles.js: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files to inject in order 3 | * (uses Grunt-style wildcard/glob/splat expressions) 4 | * 5 | * By default, Sails also supports LESS in development and production. 6 | * To use SASS/SCSS, Stylus, etc., edit the `sails-linker:devStyles` task 7 | * below for more options. For this to work, you may need to install new 8 | * dependencies, e.g. `npm install grunt-contrib-sass` 9 | */ 10 | var cssFilesToInject = [ 11 | 'styles/**/*.css' 12 | ]; 13 | 14 | /** 15 | * Javascript files to inject in order 16 | * (uses Grunt-style wildcard/glob/splat expressions) 17 | * 18 | * To use client-side CoffeeScript, TypeScript, etc., edit the 19 | * `sails-linker:devJs` task below for more options. 20 | */ 21 | 22 | var jsFilesToInject = [ 23 | 24 | // Below, as a demonstration, you'll see the built-in dependencies 25 | // linked in the proper order order 26 | 27 | // Bring in the socket.io client 28 | 'js/socket.io.js', 29 | 30 | // then beef it up with some convenience logic for talking to Sails.js 31 | 'js/sails.io.js', 32 | 33 | // A simpler boilerplate library for getting you up and running w/ an 34 | // automatic listener for incoming messages from Socket.io. 35 | 'js/app.js', 36 | 37 | // *-> put other dependencies here <-* 38 | 39 | // All of the rest of your app scripts imported here 40 | 'js/**/*.js' 41 | ]; 42 | 43 | /** 44 | * Client-side HTML templates are injected using the sources below 45 | * The ordering of these templates shouldn't matter. 46 | * (uses Grunt-style wildcard/glob/splat expressions) 47 | * 48 | * By default, Sails uses JST templates and precompiles them into 49 | * functions for you. If you want to use jade, handlebars, dust, etc., 50 | * edit the relevant sections below. 51 | */ 52 | 53 | var templateFilesToInject = [ 54 | 'template/**/*.html' 55 | ] 56 | 57 | module.exports = { 58 | // Modify css file injection paths to use 59 | cssFilesToInject: cssFilesToInject.map(function(path) { 60 | return '.tmp/public/' + path; 61 | }), 62 | 63 | // Modify js file injection paths to use 64 | jsFilesToInject: jsFilesToInject.map(function(path) { 65 | return '.tmp/public/' + path; 66 | }), 67 | 68 | 69 | templateFilesToInject: templateFilesToInject.map(function(path) { 70 | return 'assets/' + path; 71 | }) 72 | }; 73 | -------------------------------------------------------------------------------- /views/homepage.ejs: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 | 8 |
Angular seed app: v
9 | -------------------------------------------------------------------------------- /views/layout.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | My AngularJS App 6 | 7 | 8 | 9 | <%-body%> 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | --------------------------------------------------------------------------------