Skip to content

Commit

Permalink
add readme advanced usage and more full example
Browse files Browse the repository at this point in the history
  • Loading branch information
chmontgomery committed Jul 30, 2014
1 parent 434d9ba commit a4ff9b6
Show file tree
Hide file tree
Showing 49 changed files with 740 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/bower/bundle.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ module.exports = {
src: './bower_components/bootstrap/dist/fonts/**/*.*',
base: './bower_components/bootstrap/'
}

};
21 changes: 21 additions & 0 deletions examples/full/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "bower",
"version": "0.0.0",
"authors": [
"Chris Montgomery <[email protected]>"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.2.18",
"bootstrap": "~3.1.1",
"jquery": "~2.1.1",
"spin": "~0.0.1"
}
}
1 change: 1 addition & 0 deletions examples/full/bower_components/angular/angular.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("angular");
1 change: 1 addition & 0 deletions examples/full/bower_components/angular/angular.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("angular.min");
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.bootstrap {
background-color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.bootstrap.min {
background-color: blue;
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('bootstrap');
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('bootstrap.min');
1 change: 1 addition & 0 deletions examples/full/bower_components/jquery/dist/jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("jquery");
1 change: 1 addition & 0 deletions examples/full/bower_components/jquery/dist/jquery.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("jquery.min");
1 change: 1 addition & 0 deletions examples/full/bower_components/spin/spin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("spin")
52 changes: 52 additions & 0 deletions examples/full/bundle.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
var prodLikeEnvs = ['production', 'staging']; // when NODE_ENV=staging or NODE_ENV=production
module.exports = {
bundle: {
vendor: {
scripts: [
{src: './bower_components/jquery/jquery.js', minSrc: './bower_components/jquery/jquery.min.js'},
{src: './bower_components/angular/angular.js', minSrc: './bower_components/angular/angular.min.js'},
'./bower_components/spin/spin.js'
],
styles: {
src: './bower_components/bootstrap/dist/css/bootstrap.css',
minSrc: './bower_components/bootstrap/dist/css/bootstrap.min.css'
},
options: {
useMin: prodLikeEnvs, // pre-minified files
uglify: false, // never let bundler minify js since bower already ships with minified versions
rev: prodLikeEnvs // file revisioning
}
},
article: {
scripts: './lib/article/**/*.js',
styles: './lib/article/**/*.less', // if you supply .less files they will be compiled to .css for you
options: {
uglify: prodLikeEnvs,
rev: prodLikeEnvs
}
},
main: {
scripts: [
'./js/app.js',
'./js/controllers.js',
'./js/directives.js',
'./js/filters.js'
],
styles: [
'./styles/**/*.css',
'./styles/**/*.less' // mix of file types
],
options: {
uglify: prodLikeEnvs,
rev: prodLikeEnvs
}
}
},
copy: [
{
src: './bower_components/bootstrap/dist/fonts/**/*.*',
base: './bower_components/bootstrap/dist/'
},
'./images/**/*.*'
]
};
14 changes: 14 additions & 0 deletions examples/full/bundle.result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"vendor": {
"styles": "<link href='/public/vendor-bfff3428.css' media='screen' rel='stylesheet' type='text/css'/>",
"scripts": "<script src='/public/vendor-fc7efeba.js' type='text/javascript'></script>"
},
"article": {
"styles": "<link href='/public/article-c2107e48.css' media='screen' rel='stylesheet' type='text/css'/>",
"scripts": "<script src='/public/article-d41d8cd9.js' type='text/javascript'></script>"
},
"main": {
"styles": "<link href='/public/main-41e43699.css' media='screen' rel='stylesheet' type='text/css'/>",
"scripts": "<script src='/public/main-d41d8cd9.js' type='text/javascript'></script>"
}
}
21 changes: 21 additions & 0 deletions examples/full/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var gulp = require('gulp'),
rimraf = require('gulp-rimraf'),
bundle = require('../../index');

gulp.task('bundle', ['clean'], function () {

process.env.NODE_ENV = 'production'; // hardcode to always run in production mode

return gulp.src('./bundle.config.js')
.pipe(bundle())
.pipe(bundle.results({
dest: './',
pathPrefix: '/public/'
}))
.pipe(gulp.dest('./public'));
});

gulp.task('clean', function () {
return gulp.src('./public', { read: false })
.pipe(rimraf());
});
Binary file added examples/full/images/empire_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/full/images/rebel_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/full/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//placeholder
1 change: 1 addition & 0 deletions examples/full/js/controllers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//placeholder
1 change: 1 addition & 0 deletions examples/full/js/directives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//placeholder
1 change: 1 addition & 0 deletions examples/full/js/filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//placeholder
1 change: 1 addition & 0 deletions examples/full/lib/article/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//placeholder
1 change: 1 addition & 0 deletions examples/full/lib/article/scroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//placeholder
3 changes: 3 additions & 0 deletions examples/full/lib/article/styles/page.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.page {
background-color: red;
}
15 changes: 15 additions & 0 deletions examples/full/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "full",
"version": "0.0.0",
"description": "",
"main": "bundle.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^3.8.6",
"gulp-rimraf": "^0.1.0"
}
}
5 changes: 5 additions & 0 deletions examples/full/public/article-c2107e48.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/full/public/article-d41d8cd9.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Loading

0 comments on commit a4ff9b6

Please sign in to comment.