-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
…ixes #25
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.bootstrap { | ||
background-color: orange; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.bootstrap-min {background-color: coral;} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("jquery"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("jquery.min"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.always-first { | ||
background-color: red; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("first"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.always-last { | ||
background-color: green; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("last"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fileName = 'file1.coffee' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.file1-less { | ||
background-color: purple; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fileName = 'file2.coffee' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.file2-less { | ||
background-color: yellow; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.something-in-the-middle { | ||
background-color: blue; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("something in the middle"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("lodash"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vendor { | ||
background-color: wheat; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Guarantee Bundle Content Order | ||
|
||
The bundle config supports ordering the src files via `gulp-order` syntax (e.g. wildcards, etc). See here for details on syntax: https://github.com/sirlantis/gulp-order | ||
|
||
To use simply add your ordering array to the `order` option: | ||
|
||
```js | ||
module.exports = { | ||
bundle: { | ||
main: { | ||
scripts: [ | ||
{ | ||
src: './vendor/second.js', | ||
minSrc: './vendor/second.min.js' | ||
}, | ||
'./a/*.coffee', | ||
'./content/**/*.coffee', | ||
'./content/**/*.js' | ||
] | ||
options: { | ||
order: { | ||
scripts: [ | ||
'**/always-first.js', // from /content | ||
'**/second*.js', // depending on env, this could be streaming min or non-min file so use trailing * | ||
'**/third.js', // compiled from third.coffee | ||
'**/fourth.js', // compiled from fourth.coffee | ||
'!**/always-last.js', // everything else except always-last.js | ||
'**/always-last.js' // from /content | ||
] | ||
}, | ||
transforms: { | ||
scripts: transformHelper.coffee() | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
``` | ||
|
||
### Examples | ||
|
||
* This example [`bundle.config.js`](bundle.config.js#L25) | ||
* full example [`bundle.config.js`](../full/bundle.config.js#L155) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fileName = 'fourth' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.fourth { | ||
background-color: purple; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
var transformHelper = require('../../index.js').transformHelper; | ||
|
||
module.exports = { | ||
bundle: { | ||
'ordered-bundle': { | ||
scripts: [ | ||
{ | ||
src: './vendor/second.js', | ||
minSrc: './vendor/second.min.js' | ||
}, | ||
'./a/*.coffee', | ||
'./content/**/*.coffee', | ||
'./content/**/*.js' | ||
], | ||
styles: [ | ||
{ | ||
src: './vendor/second.css', | ||
minSrc: './vendor/second.min.css' | ||
}, | ||
'./a/*.less', | ||
'./content/**/*.less', | ||
'./content/**/*.css' | ||
], | ||
options: { | ||
order: { | ||
scripts: [ | ||
'**/always-first.js', // from /content | ||
'**/second*.js', // depending on env, this could be streaming min or non-min file so use trailing * | ||
'**/third.js', // compiled from third.coffee | ||
'**/fourth.js', // compiled from fourth.coffee | ||
'!**/always-last.js', // everything else except always-last.js | ||
'**/always-last.js' // from /content | ||
], | ||
styles: [ | ||
'**/always-first.css', // from /content | ||
'**/second*.css', // depending on env, this could be streaming min or non-min file so use trailing * | ||
'**/third.css', // compiled from third.less | ||
'**/fourth.css', // compiled from fourth.less | ||
'!**/always-last.css', // everything else except always-last.css | ||
'**/always-last.css' // from /content | ||
] | ||
}, | ||
useMin: 'production', | ||
transforms: { | ||
scripts: transformHelper.coffee(), | ||
styles: transformHelper.less() | ||
} | ||
} | ||
} | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.always-last { | ||
background-color: green; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('last'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.fifth { | ||
background-color: blue; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('fifth'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.always-first { | ||
background-color: red; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('first'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fileName = 'third' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.third { | ||
background-color: yellow; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var gulp = require('gulp'), | ||
del = require('del'), | ||
bundle = require('../../index'); | ||
|
||
gulp.task('bundle', ['clean'], function () { | ||
return gulp.src('./bundle.config.js') | ||
.pipe(bundle()) | ||
.pipe(gulp.dest('./dist')); | ||
}); | ||
|
||
gulp.task('clean', function (cb) { | ||
del([ | ||
'./dist' | ||
], cb); | ||
}); | ||
|
||
gulp.task('default', ['bundle']); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "guarantee-content-order", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "bundle.config.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"del": "^1.2.0", | ||
"gulp": "^3.9.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.second { | ||
background-color: orange; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('second'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.second-min {background-color: coral;} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('second.min'); |