Skip to content

Instantly share code, notes, and snippets.

@bsr203
Created December 31, 2012 18:18
Show Gist options
  • Save bsr203/4421791 to your computer and use it in GitHub Desktop.
Save bsr203/4421791 to your computer and use it in GitHub Desktop.
yeo] $ tree
.
├── Gruntfile.js
├── app
│   ├── 404.html
│   ├── favicon.ico
│   ├── index.html
│   ├── robots.txt
│   ├── scripts
│   │   ├── app.js
│   │   ├── controllers
│   │   │   └── main.js
│   │   └── vendor
│   │   ├── angular.js
│   │   ├── angular.min.js
│   │   ├── es5-shim.min.js
│   │   └── json3.min.js
│   ├── styles
│   │   └── main.css
│   └── views
│   └── main.html
├── dist
│   ├── 404.html
│   ├── favicon.ico
│   ├── index.html
│   ├── manifest.appcache
│   ├── robots.txt
│   ├── scripts
│   │   ├── 971583c3.app.js
│   │   ├── 9eecb7db.scripts.js
│   │   ├── controllers
│   │   │   └── 58d4644f.main.js
│   │   └── vendor
│   │   ├── 23419e86.angular.min.js
│   │   ├── 241d7c33.json3.min.js
│   │   ├── 61e2728c.es5-shim.min.js
│   │   └── d10639ae.angular.js
│   ├── styles
│   │   └── 051c0509.main.css
│   └── views
│   └── main.html
├── package.json
├── temp
│   ├── 404.html
│   ├── favicon.ico
│   ├── index.html
│   ├── manifest.appcache
│   ├── robots.txt
│   ├── scripts
│   │   ├── 971583c3.app.js
│   │   ├── 9eecb7db.scripts.js
│   │   ├── controllers
│   │   │   └── 58d4644f.main.js
│   │   └── vendor
│   │   ├── 23419e86.angular.min.js
│   │   ├── 241d7c33.json3.min.js
│   │   ├── 61e2728c.es5-shim.min.js
│   │   └── d10639ae.angular.js
│   ├── styles
│   │   └── 051c0509.main.css
│   └── views
│   └── main.html
├── test
│   ├── spec
│   │   └── controllers
│   │   └── main.js
│   └── vendor
│   └── angular-mocks.js
└── testacular.conf.js
module.exports = function( grunt ) {
'use strict';
//
// Grunt configuration:
//
// https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
//
grunt.initConfig({
// Project configuration
// ---------------------
// specify an alternate install location for Bower
bower: {
dir: 'app/components'
},
// Coffee to JS compilation
coffee: {
compile: {
files: {
'app/scripts/*.js': 'app/scripts/**/*.coffee',
'test/spec/*.js': 'test/spec/**/*.coffee'
}
}
},
// compile .scss/.sass to .css using Compass
compass: {
dist: {
// http://compass-style.org/help/tutorials/configuration-reference/#configuration-properties
options: {
css_dir: 'temp/styles',
sass_dir: 'app/styles',
images_dir: 'app/images',
javascripts_dir: 'temp/scripts',
force: true
}
}
},
// generate application cache manifest
manifest:{
dest: ''
},
// default watch configuration
watch: {
coffee: {
files: 'app/scripts/**/*.coffee',
tasks: 'coffee reload'
},
compass: {
files: [
'app/styles/**/*.{scss,sass}'
],
tasks: 'compass reload'
},
reload: {
files: [
'app/*.html',
'app/styles/**/*.css',
'app/scripts/**/*.js',
'app/views/**/*.html',
'app/images/**/*'
],
tasks: 'reload'
}
},
// default lint configuration, change this to match your setup:
// https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task
lint: {
files: [
'Gruntfile.js',
'app/scripts/**/*.js',
'spec/**/*.js'
]
},
// specifying JSHint options and globals
// https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true
},
globals: {
angular: true
}
},
// Build configuration
// -------------------
// the staging directory used during the process
staging: 'temp',
// final build output
output: 'dist',
mkdirs: {
staging: 'app/'
},
// Below, all paths are relative to the staging directory, which is a copy
// of the app/ directory. Any .gitignore, .ignore and .buildignore file
// that might appear in the app/ tree are used to ignore these values
// during the copy process.
// concat css/**/*.css files, inline @import, output a single minified css
css: {
'styles/main.css': ['styles/**/*.css']
},
// renames JS/CSS to prepend a hash of their contents for easier
// versioning
rev: {
js: 'scripts/**/*.js',
css: 'styles/**/*.css',
img: 'images/**'
},
// usemin handler should point to the file containing
// the usemin blocks to be parsed
'usemin-handler': {
html: 'index.html'
},
// update references in HTML/CSS to revved files
usemin: {
html: ['**/*.html'],
css: ['**/*.css']
},
// HTML minification
html: {
files: ['**/*.html']
},
// Optimizes JPGs and PNGs (with jpegtran & optipng)
img: {
dist: '<config:rev.img>'
},
// rjs configuration. You don't necessarily need to specify the typical
// `path` configuration, the rjs task will parse these values from your
// main module, using http://requirejs.org/docs/optimization.html#mainConfigFile
//
// name / out / mainConfig file should be used. You can let it blank if
// you're using usemin-handler to parse rjs config from markup (default
// setup)
rjs: {
// no minification, is done by the min task
optimize: 'none',
baseUrl: './scripts',
wrap: true
}
});
// Alias the `test` task to run `testacular` instead
grunt.registerTask('test', 'run the testacular test driver', function () {
var done = this.async();
require('child_process').exec('testacular start --single-run', function (err, stdout) {
grunt.log.write(stdout);
done(err);
});
});
};
bsr[~/Work/Programming/tmp] $ mkdir yeo
bsr[~/Work/Programming/tmp] $ cd yeo/
bsr[~/Work/Programming/tmp/yeo] $ yeoman init angular
Running "init:yeoman" (init) task
This task will create one or more files in the current directory, based on the
environment and the answers to a few questions. Note that answering "?" to any
question will show question-specific help and answering "none" to most questions
will leave its value blank.
"yeoman" template notes:
invoke angular
Please answer the following:
[?] Would you like to include Twitter Bootstrap? (Y/n) n
[?] If so, would you like to use Twitter Bootstrap for Compass (as opposed to vanilla CSS)? (Y/n) n
[?] Do you need to make any changes to the above before continuing? (y/N) N
invoke angular:common:angular
create .gitattributes
create .npmignore
create app/.buildignore
create app/.htaccess
create app/404.html
create app/favicon.ico
create app/robots.txt
create app/scripts/vendor/angular.js
create app/scripts/vendor/angular.min.js
create app/scripts/vendor/es5-shim.min.js
create app/scripts/vendor/json3.min.js
create app/styles/main.css
create app/views/main.html
create Gruntfile.js
create package.json
create test/vendor/angular-mocks.js
invoke angular:app:angular
create app/scripts/app.js
create app/index.html
invoke angular:controller:angular
create app/scripts/controllers/main.js
create test/spec/controllers/main.js
invoke testacular:app:angular
create testacular.conf.js
bsr[~/Work/Programming/tmp/yeo] $ yeoman server
Running "server" task
Starting static web server on port 3501
- /Users/bsr/Work/Programming/tmp/yeo/app
I'll also watch your files for changes, recompile if neccessary and live reload the page.
Hit Ctrl+C to quit.
Running "clean" task
Running "coffee:compile" (coffee) task
Unable to compile; no valid source files were found.
Unable to compile; no valid source files were found.
Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Running "open-browser" task
Running "watch" task
Waiting...^Cbsr[~/Work/Programming/tmp/yeo] $ yeoman build
Running "build" task
Running usemin target
- intro clean coffee compass mkdirs usemin-handler rjs concat css min img rev usemin manifest copy time
Running "intro" task
Running "clean" task
Running "coffee:compile" (coffee) task
Unable to compile; no valid source files were found.
Unable to compile; no valid source files were found.
Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Running "mkdirs:staging" (mkdirs) task
Copying into /Users/bsr/Work/Programming/tmp/yeo/temp
Ignoring .gitignore, .ignore, .buildignore
...................
>> /Users/bsr/Work/Programming/tmp/yeo/app -> /Users/bsr/Work/Programming/tmp/yeo/temp
Running "usemin-handler:html" (usemin-handler) task
Going through index.html to update the config
looking for build script HTML comment blocks
Found a block:
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
Updating config with the following assets:
- scripts/app.js
- scripts/controllers/main.js
Configuration is now:
css:
{ 'styles/main.css': [ 'styles/**/*.css' ] }
concat:
{ 'scripts/scripts.js':
[ 'scripts/app.js',
'scripts/controllers/main.js' ] }
min:
{ 'scripts/scripts.js': 'scripts/scripts.js' }
rjs:
{ optimize: 'none',
baseUrl: './scripts',
wrap: true }
Running "rjs" task
No data-main attribute found in application index, bypassing the task...
Running "concat:scripts/scripts.js" (concat) task
File "scripts/scripts.js" created.
Running "css:styles/main.css" (css) task
Writing css files to styles/main.css...
Running "min:scripts/scripts.js" (min) task
File "scripts/scripts.js" created.
Uncompressed size: 451 bytes.
Compressed size: 234 bytes gzipped (305 bytes minified).
Running "img:dist" (img) task
Running "rev:js" (rev) task
scripts/app.js >> 971583c3.app.js
scripts/controllers/main.js >> 58d4644f.main.js
scripts/scripts.js >> f5241df7.scripts.js
scripts/vendor/angular.js >> d10639ae.angular.js
scripts/vendor/angular.min.js >> 23419e86.angular.min.js
scripts/vendor/es5-shim.min.js >> 61e2728c.es5-shim.min.js
scripts/vendor/json3.min.js >> 241d7c33.json3.min.js
Running "rev:css" (rev) task
styles/main.css >> 051c0509.main.css
Running "rev:img" (rev) task
Running "usemin:html" (usemin) task
usemin:html - 404.html
usemin:html - index.html
>> scripts/vendor/es5-shim.min.js
was <script src="scripts/vendor/es5-shim.min.js"></script>
now <script src="scripts/vendor/61e2728c.es5-shim.min.js"></script>
>> scripts/vendor/json3.min.js
was <script src="scripts/vendor/json3.min.js"></script>
now <script src="scripts/vendor/241d7c33.json3.min.js"></script>
>> scripts/vendor/angular.js
was <script src="scripts/vendor/angular.js"></script>
now <script src="scripts/vendor/d10639ae.angular.js"></script>
>> scripts/scripts.js
was <script src="scripts/scripts.js"></script>
now <script src="scripts/f5241df7.scripts.js"></script>
>> styles/main.css
was <link rel="stylesheet" href="styles/main.css"
now <link rel="stylesheet" href="styles/051c0509.main.css"
usemin:html - views/main.html
Running "usemin:css" (usemin) task
usemin:css - styles/051c0509.main.css
Running "manifest" task
Starting static web server on port 3501
- /Users/bsr/Work/Programming/tmp/yeo/temp
I'll also watch your files for changes, recompile if neccessary and live reload the page.
Hit Ctrl+C to quit.
Generating the cache manifest
- Command: phantomjs /usr/local/lib/node_modules/yeoman/lib/support/confess.js http://localhost:3501 appcache /usr/local/lib/node_modules/yeoman/lib/support/confess.json
Writing to manifest.appcache...
# Error: Unknown provider: aProvider <- a
at http://localhost:3501/scripts/vendor/d10639ae.angular.js:2627
at getService (http://localhost:3501/scripts/vendor/d10639ae.angular.js:2755)
at http://localhost:3501/scripts/vendor/d10639ae.angular.js:2632
at getService (http://localhost:3501/scripts/vendor/d10639ae.angular.js:2755)
at invoke (http://localhost:3501/scripts/vendor/d10639ae.angular.js:2773)
at instantiate (http://localhost:3501/scripts/vendor/d10639ae.angular.js:2805)
at http://localhost:3501/scripts/vendor/d10639ae.angular.js:4620
at update (http://localhost:3501/scripts/vendor/d10639ae.angular.js:13692)
at http://localhost:3501/scripts/vendor/d10639ae.angular.js:8002 (undefined, #undefined)
CACHE MANIFEST
# Time: Mon Dec 31 2012 13:13:41 GMT-0500 (EST)
# This manifest was created by confess.js, http://github.com/jamesgpearce/confess
#
# Retrieved URL: http://localhost:3501/#/
# User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11
#
# Config:
# task: appcache
# userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11
# wait: 0
# consolePrefix: #
# verbose: true
# appcache:
# urlsFromDocument: true
# urlsFromRequests: false
# cacheFilter: .*
# networkFilter: null
# url: http://localhost:3501
# configFile: /usr/local/lib/node_modules/yeoman/lib/support/confess.json
CACHE:
http://www.google-analytics.com/ga.js
scripts/f5241df7.scripts.js
scripts/vendor/d10639ae.angular.js
styles/051c0509.main.css
NETWORK:
*
OK
Running "copy" task
.....................
>> /Users/bsr/Work/Programming/tmp/yeo/temp -> /Users/bsr/Work/Programming/tmp/yeo/dist
Running "time" task
>> Build success. Done in 4.141s
Done, without errors.
bsr[~/Work/Programming/tmp/yeo] $ cat dist/
.buildignore 404.html index.html robots.txt styles/
.htaccess favicon.ico manifest.appcache scripts/ views/
bsr[~/Work/Programming/tmp/yeo] $ cat dist/scripts/
971583c3.app.js controllers/ f5241df7.scripts.js vendor/
bsr[~/Work/Programming/tmp/yeo] $ cat dist/scripts/f5241df7.scripts.js
"use strict";var yeoApp=angular.module("yeoApp",[]).config(["$routeProvider",function(a){a.when("/",{templateUrl:"views/main.html",controller:"MainCtrl"}).otherwise({redirectTo:"/"})}]);"use strict",yeoApp.controller("MainCtrl",function(a){a.awesomeThings=["HTML5 Boilerplate","AngularJS","Testacular"]});bsr[~/Work/Programming/tmp/yeo] $ subl .
bsr[~/Work/Programming/tmp/yeo] $ yeoman build
Running "build" task
Running usemin target
- intro clean coffee compass mkdirs usemin-handler rjs concat css min img rev usemin manifest copy time
Running "intro" task
Running "clean" task
Running "coffee:compile" (coffee) task
Unable to compile; no valid source files were found.
Unable to compile; no valid source files were found.
Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Running "mkdirs:staging" (mkdirs) task
Copying into /Users/bsr/Work/Programming/tmp/yeo/temp
Ignoring .gitignore, .ignore, .buildignore
...................
>> /Users/bsr/Work/Programming/tmp/yeo/app -> /Users/bsr/Work/Programming/tmp/yeo/temp
Running "usemin-handler:html" (usemin-handler) task
Going through index.html to update the config
looking for build script HTML comment blocks
Found a block:
<script src="/scripts/app.js"></script>
<script src="/scripts/controllers/main.js"></script>
Updating config with the following assets:
- /scripts/app.js
- /scripts/controllers/main.js
Configuration is now:
css:
{ 'styles/main.css': [ 'styles/**/*.css' ] }
concat:
{ 'scripts/scripts.js':
[ '/scripts/app.js',
'/scripts/controllers/main.js' ] }
min:
{ 'scripts/scripts.js': 'scripts/scripts.js' }
rjs:
{ optimize: 'none',
baseUrl: './scripts',
wrap: true }
Running "rjs" task
No data-main attribute found in application index, bypassing the task...
Running "concat:scripts/scripts.js" (concat) task
File "scripts/scripts.js" created.
Running "css:styles/main.css" (css) task
Writing css files to styles/main.css...
Running "min:scripts/scripts.js" (min) task
File "scripts/scripts.js" created.
Uncompressed size: 0 bytes.
Compressed size: 21 bytes gzipped (1 bytes minified).
Running "img:dist" (img) task
Running "rev:js" (rev) task
scripts/app.js >> 971583c3.app.js
scripts/controllers/main.js >> 58d4644f.main.js
scripts/scripts.js >> 9eecb7db.scripts.js
scripts/vendor/angular.js >> d10639ae.angular.js
scripts/vendor/angular.min.js >> 23419e86.angular.min.js
scripts/vendor/es5-shim.min.js >> 61e2728c.es5-shim.min.js
scripts/vendor/json3.min.js >> 241d7c33.json3.min.js
Running "rev:css" (rev) task
styles/main.css >> 051c0509.main.css
Running "rev:img" (rev) task
Running "usemin:html" (usemin) task
usemin:html - 404.html
usemin:html - index.html
>> scripts/vendor/es5-shim.min.js
was <script src="scripts/vendor/es5-shim.min.js"></script>
now <script src="scripts/vendor/61e2728c.es5-shim.min.js"></script>
>> scripts/vendor/json3.min.js
was <script src="scripts/vendor/json3.min.js"></script>
now <script src="scripts/vendor/241d7c33.json3.min.js"></script>
>> scripts/vendor/angular.js
was <script src="scripts/vendor/angular.js"></script>
now <script src="scripts/vendor/d10639ae.angular.js"></script>
>> scripts/scripts.js
was <script src="scripts/scripts.js"></script>
now <script src="scripts/9eecb7db.scripts.js"></script>
>> styles/main.css
was <link rel="stylesheet" href="styles/main.css"
now <link rel="stylesheet" href="styles/051c0509.main.css"
usemin:html - views/main.html
Running "usemin:css" (usemin) task
usemin:css - styles/051c0509.main.css
Running "manifest" task
Starting static web server on port 3501
- /Users/bsr/Work/Programming/tmp/yeo/temp
I'll also watch your files for changes, recompile if neccessary and live reload the page.
Hit Ctrl+C to quit.
Generating the cache manifest
- Command: phantomjs /usr/local/lib/node_modules/yeoman/lib/support/confess.js http://localhost:3501 appcache /usr/local/lib/node_modules/yeoman/lib/support/confess.json
Writing to manifest.appcache...
Error: No module: yeoApp
http://localhost:3501/scripts/vendor/d10639ae.angular.js:1058
http://localhost:3501/scripts/vendor/d10639ae.angular.js:999 in ensure
http://localhost:3501/scripts/vendor/d10639ae.angular.js:1230 in module
http://localhost:3501/scripts/vendor/d10639ae.angular.js:2699
CACHE MANIFEST
# Time: Mon Dec 31 2012 13:14:55 GMT-0500 (EST)
# This manifest was created by confess.js, http://github.com/jamesgpearce/confess
#
# Retrieved URL: http://localhost:3501/
# User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11
#
# Config:
# task: appcache
# userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11
# wait: 0
# consolePrefix: #
# verbose: true
# appcache:
# urlsFromDocument: true
# urlsFromRequests: false
# cacheFilter: .*
# networkFilter: null
# url: http://localhost:3501
# configFile: /usr/local/lib/node_modules/yeoman/lib/support/confess.json
CACHE:
http://www.google-analytics.com/ga.js
scripts/9eecb7db.scripts.js
scripts/vendor/d10639ae.angular.js
styles/051c0509.main.css
NETWORK:
*
OK
Running "copy" task
.....................
>> /Users/bsr/Work/Programming/tmp/yeo/temp -> /Users/bsr/Work/Programming/tmp/yeo/dist
Running "time" task
>> Build success. Done in 2.766s
Done, without errors.
bsr[~/Work/Programming/tmp/yeo] $ cat dist/s
scripts/ styles/
bsr[~/Work/Programming/tmp/yeo] $ cat dist/scripts/
971583c3.app.js 9eecb7db.scripts.js controllers/ vendor/
bsr[~/Work/Programming/tmp/yeo] $ cat dist/scripts/9eecb7db.scripts.js
bsr[~/Work/Programming/tmp/yeo] $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment