Skip to content

Instantly share code, notes, and snippets.

@onefriendaday
Created May 4, 2015 05:40
Show Gist options
  • Select an option

  • Save onefriendaday/6b347b186171ec140688 to your computer and use it in GitHub Desktop.

Select an option

Save onefriendaday/6b347b186171ec140688 to your computer and use it in GitHub Desktop.
Browserify Grunt example
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default',['watch']);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'web/assets/css/style.css' : 'source/sass/style.scss'
}
}
},
browserify: {
options: {
transform: ['vueify']
},
dist: {
files: {
'web/assets/js/app.js': 'source/js/index.js'
}
}
},
watch: {
app: {
files: ["source/js/**/*"],
tasks: ["browserify"],
options: {
spawn: false,
}
},
libs: {
files: ["bower_components/**/*"],
tasks: ["concat"]
},
css: {
files: 'source/sass/*.scss',
tasks: ['sass'],
options: {
livereload: true,
}
}
},
concat: {
options: {
separator: ';',
},
dist: {
src: [
'bower_components/jquery/dist/jquery.js',
'bower_components/uikit/js/uikit.js',
'bower_components/uikit/js/components/nestable.js',
'bower_components/humanize-plus/public/src/humanize.js',
'bower_components/hogan/web/builds/3.0.2/hogan-3.0.2.min.js'
],
dest: 'web/assets/js/libs.js',
},
},
});
grunt.registerTask('serve',[
'concat',
'browserify',
'sass',
'watch'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment