Skip to content

Commit

Permalink
Changing browserify with rollup.js
Browse files Browse the repository at this point in the history
  • Loading branch information
artberri committed Jan 23, 2016
1 parent bffe3e1 commit 66a727a
Show file tree
Hide file tree
Showing 7 changed files with 567 additions and 635 deletions.
4 changes: 4 additions & 0 deletions .babelrc
@@ -0,0 +1,4 @@
{
"sourceMap": true,
"presets": ['babel-preset-es2015-rollup']
}
57 changes: 31 additions & 26 deletions Gruntfile.js
@@ -1,4 +1,6 @@
/* eslint global-require:0 */
var babel = require('rollup-plugin-babel');

module.exports = function(grunt) {

require('load-grunt-tasks')(grunt);
Expand All @@ -7,6 +9,12 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
' * Copyright (c) 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= pkg.license %> */\n',

clean: {
dist: ['dist'],
cssmin: [
Expand All @@ -32,11 +40,7 @@ module.exports = function(grunt) {

uglify: {
options: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
' * Copyright (c) 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= pkg.license %> */\n'
banner: '<%= banner %>'
},
dist: {
files: {
Expand Down Expand Up @@ -68,7 +72,7 @@ module.exports = function(grunt) {
watch: {
js: {
files: ['src/jquery.sidr.js', 'src/js/*.js'],
tasks: 'browserify'
tasks: 'rollup'
},
compass: {
files: ['src/scss/**/*.scss'],
Expand Down Expand Up @@ -107,24 +111,6 @@ module.exports = function(grunt) {
}
},

browserify: {
dist: {
options: {
transform: [
['babelify', {
sourceMap: true,
presets: ['babel-preset-es2015']
}]
]
},
files: {
'dist/jquery.<%= pkg.name %>.js': [
'src/jquery.<%= pkg.name %>.js'
]
}
}
},

karma: {
unit: {
configFile: 'karma.conf.js',
Expand Down Expand Up @@ -153,6 +139,25 @@ module.exports = function(grunt) {
open: 'http://localhost:9000/examples/index.html'
}
}
},

rollup: {
options: {
banner: '<%= banner %>',
format: 'iife',
globals: {
jquery: 'jQuery'
},
plugins: [
babel({
exclude: './node_modules/**'
})
]
},
files: {
dest: 'dist/jquery.<%= pkg.name %>.js',
src: 'src/jquery.<%= pkg.name %>.js'
}
}

});
Expand All @@ -172,7 +177,7 @@ module.exports = function(grunt) {
]);

grunt.registerTask('build', [
'browserify',
'rollup',
'compass:distmin',
'copy:cssmin',
'clean:cssmin',
Expand All @@ -183,7 +188,7 @@ module.exports = function(grunt) {
grunt.registerTask('serve', [
'clean:dist',
'compass:dev',
'browserify',
'rollup',
'connect:dist',
'watch'
]);
Expand Down

0 comments on commit 66a727a

Please sign in to comment.