Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 48 additions & 53 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,56 @@
/*global module:false*/
module.exports = function(grunt){
module.exports = function (grunt) {
const srcFiles = 'src/**/*.js';
const distDir = 'dist/';


// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower: grunt.file.readJSON('bower.json'),
copy: {
demo: {
files: [
{expand: true, src: ['src/*'], dest: 'dist/', filter: 'isFile', flatten: true}
]
}
},
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower: grunt.file.readJSON('bower.json'),

uglify: {
options: {
beautify: {
ascii_only : true
},
preserveComments: 'some'
},
html5shiv: {
files: [{
expand: true, // Enable dynamic expansion.
cwd: 'src/', // Src matches are relative to this path.
src: ['**/*.js'], // Actual pattern(s) to match.
dest: 'dist/', // Destination path prefix.
ext: '.min.js'
}]
}
},
watch: {
js: {
files: ['src/**/*.js'],
tasks: ['copy', 'uglify', 'bytesize']
}
},
bytesize: {
all: {
src: [
'dist/**.min.js'
]
}
}
});
copy: {
demo: {
files: [
{ expand: true, cwd: 'src/', src: ['*'], dest: distDir, flatten: true }
]
}
},


// Default task.
uglify: {
options: {
beautify: { ascii_only: true },
preserveComments: 'some'
},
html5shiv: {
files: [{
expand: true,
cwd: 'src/',
src: ['**/*.js'],
dest: distDir,
ext: '.min.js'
}]
}
},


watch: {
js: {
files: [srcFiles],
tasks: ['copy', 'uglify', 'bytesize']
}
},

grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-bytesize');
bytesize: {
all: {
src: [`${distDir}*.min.js`]
}
}
});

grunt.registerTask('default', ['copy', 'uglify', 'bytesize', 'watch']);
[
'grunt-contrib-copy',
'grunt-contrib-uglify',
'grunt-contrib-watch',
'grunt-bytesize'
].forEach(task => grunt.loadNpmTasks(task));

grunt.registerTask('default', ['copy', 'uglify', 'bytesize']);
grunt.registerTask('dev', ['default', 'watch']);
};