Skip to content

Commit

Permalink
插件js拆分成多个模块,使用grunt合并压缩
Browse files Browse the repository at this point in the history
  • Loading branch information
BaoCunGui committed Oct 5, 2016
1 parent f1c0109 commit 972c816
Show file tree
Hide file tree
Showing 29 changed files with 3,108 additions and 1,311 deletions.
55 changes: 35 additions & 20 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,47 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

concat: {
dist: {
options: {
// separator: '\n',
banner: '/**\n' +
' * <%= pkg.name %>\n' +
' * Version: <%= pkg.version %>\n' +
' * URI: <%= pkg.uri %>\n' +
' * Date: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' **/'
},
src: [
'src/global.js',
'src/main.js',
'src/init.js',
'src/default-style.js',
'src/set-style.js',
'src/add-element.js',
'src/bind-animation.js',
'src/bind-event.js',
'src/lazyload.js',
],
dest: 'dist/jquery.<%= pkg.name %>.pkgd.js',
}
},

uglify: {
options: {
banner: '/* <%= pkg.name %> v<%= pkg.version %> | <%= pkg.uri %>*/\n'
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - <%= pkg.uri %>' +
' - <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},

'dist/jquery.<%= pkg.name %>.min.js': 'src/jquery.<%= pkg.name %>.js'
my_target: {
files: {
'dist/jquery.<%= pkg.name %>.min.js': ['dist/jquery.<%= pkg.name %>.pkgd.js']
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');

// Project configuration.
// grunt.initConfig({
// pkg: grunt.file.readJSON('package.json'),
// concat: {
// options: {
// stripBanners: true,
// banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
// '<%= grunt.template.today("yyyy-mm-dd") %> */',
// },
// dist: {
// src: ['src/project.js'],
// dest: 'dist/built.js',
// },
// },
// });

grunt.registerTask('default', ['uglify']);
grunt.registerTask('default', ['concat', 'uglify']);
};
2 changes: 0 additions & 2 deletions complete/jquery.terseBanner.min.js

This file was deleted.

3 changes: 3 additions & 0 deletions dist/jquery.terseBanner.min.js

Large diffs are not rendered by default.

1,385 changes: 1,385 additions & 0 deletions dist/jquery.terseBanner.pkgd.js

Large diffs are not rendered by default.

Loading

0 comments on commit 972c816

Please sign in to comment.