backbone-named-routes
Version:
Backbone router implementation with named routes (aliases) for easy client side links generation
108 lines (92 loc) • 3 kB
JavaScript
var attire = require('attire');
module.exports = function(grunt) {
grunt.initConfig({
uglify: {
min: {
files: [{
expand: true,
cwd: 'src',
src: '**/*.js',
dest: 'dist',
ext: '.min.js'
}]
}
},
copy: {
jsFiles: {
files: [{
expand: true,
cwd: 'src',
src: ['**/*.js'],
dest: 'dist'
}]
}
},
eslint: {
options: {
configFile: '.eslintrc.js'
},
target: ['src/**/*.js', 'Gruntfile.js', 'test/index.js']
},
watch: {
readme: {
expand: true,
files: ['README.md'],
tasks: ['buildDemo'],
options: {
spawn: false
}
},
jsFiles: {
expand: true,
files: ['src/**/*.js'],
tasks: ['eslint', 'uglify', 'copy'],
options: {
spawn: false
}
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
commitFiles: ['package.json', 'bower.json'],
tagName: '%VERSION%',
push: false
}
}
});
grunt.registerTask('buildDemo', function() {
var done = this.async();
attire.buildDemo({
file: 'README.md',
dest: 'index.html',
title: 'Backbone named routes',
description: 'Backbone router implementation with named routes (aliases) for easy client side links generation',
canonicalUrl: 'http://dbrekalo.github.io/backbone-named-routes/',
githubUrl: 'https://github.com/dbrekalo/backbone-named-routes',
userRepositories: {
user: 'dbrekalo',
onlyWithPages: true
},
author: {
caption: 'Damir Brekalo',
url: 'https://github.com/dbrekalo',
image: 'https://s.gravatar.com/avatar/32754a476fb3db1c5a1f9ad80c65d89d?s=80',
email: 'dbrekalo@gmail.com',
github: 'https://github.com/dbrekalo',
twitter: 'https://twitter.com/dbrekalo'
},
afterParse: function($) {
$('p').first().remove();
$('a').first().parent().remove();
},
inlineCss: true,
}).then(function() {
done();
grunt.log.ok(['Demo builded']);
});
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['build', 'watch']);
grunt.registerTask('build', ['eslint', 'uglify', 'copy', 'buildDemo']);
};