Professional Documents
Culture Documents
file task
BUILD Output
SYSTEMS file
gruntjs.com
+2 years old
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
autoprefixer: {
options: {
browsers: ['last 2 version', 'ie 8', 'ie 9']
},
styles: {
expand: true,
flatten: true,
src: '<%=src%>/assets/css/*.css',
dest: '<%=src%>/assets/css/'
},
},
Complex Task
assemble: {
options: {
flatten: true,
data: ['<%=site.source%>/data/*.{json,yml}', 'package.json'],
plugins: [
'assemble-middleware-permalinks',
'assemble-middleware-anchors',
'assemble-middleware-wordcount'
],
helpers: [
'handlebars-helper-compose',
'handlebars-helper-moment',
'./src/js/helpers/*.js' // Custom helpers
],
assets: '<%=site.development%>/assets',
partials: [opt.tpl + '/partials/**/*.{hbs,md}', opt.tpl + '/snippets/**/*.{hbs,md}'],
layoutdir: opt.tpl + '/layouts',
layout: 'default.hbs',
collections: [
{
name: 'post',
sortby: 'date',
sortorder: 'descending',
pages: [opt.posts]
}
],
marked: {
highlight: function (code, lang) {
if (lang === undefined) lang = 'bash';
if (lang === 'js') lang = 'javascript';
if (lang === 'less') lang = 'scss';
return hljs.highlight(lang, code).value;
}
},
sitemap: {
homepage: '<%=site.url%>',
changefreq: 'daily',
priority: '0.8',
robot: true
},
permalinks: {
structure: ':basename/index.html'
},
compose: {
cwd: opt.posts
}
},
pages: {
files: [
{
src: opt.pages + '/*.{hbs,md}',
dest: opt.dev + '/'
}
]
},
posts: {
options: {
layout: 'layout-blog.hbs',
permalinks: {
structure: ':year/:basename/index.html'
},
feed: {
debug: true,
prettify: true,
dest: 'rss.xml'
},
wordcount: { selector: '.article-content' }
},
files: [
{
src: opt.posts + '/**/*.{hbs,md}',
dest: opt.dev + '/'
},
{
src: opt.pages + '/index.hbs',
dest: opt.dev + '/index.html'
}
]
},
projects: {
permalinks: {
structure: ':year/:basename/index.html'
},
files: [
{
src: opt.projects + '/*.{hbs,md}',
dest: opt.dev + '/'
}
]
gulpjs.com
>1 year old
Read Write
Task 1 Task 2 Task 3
file(s) file(s)
File
Output system
Input Output
File temp
system folder
File
Hopefully not what you imagined Final Output system
Grunt
Plugins are simple and do one thing most are a ~20 line function
github.com/substack/stream-handbook#pipe
.pipe(foo) returns foo, e.g.,
a.pipe(b).pipe(c).pipe(d)
is the same as
a.pipe(b);
b.pipe(c);
c.pipe(d);
.pipe() in gulp
gulp-less gulp-help
gulp-uglify gulp-notify
gulp-concat gulp-autoprefixer
gulp-header gulp-recess
gulp-minify-css moment
One can use
Node packages instead
of gulp plugins
npmjs.org/package/del = npmjs.org/package/gulp-clean
npm install gulp-grunt
npmjs.org/package/gulp-grunt
Gulp aint
all awesome
Error management good
Use cases
Because build systems should
empower, not impede
Continue using Grunt on pre-existing projects
Continue using Grunt with dev teams that are used to it
@pburtchaell
pburchaell.com
gibbon.co/pb/gulp