Skip to content

Commit

Permalink
add grunt file to generate pkgd files
Browse files Browse the repository at this point in the history
Fixes #127
tick version v3.1.5
  • Loading branch information
desandro committed Apr 20, 2014
1 parent 0c0de54 commit 182e3e4
Show file tree
Hide file tree
Showing 8 changed files with 992 additions and 5 deletions.
62 changes: 62 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

// -------------------------- grunt -------------------------- //

module.exports = function( grunt ) {

// get banner comment from imagesloaded.js
var banner = ( function() {
var contents = grunt.file.read('imagesloaded.js');
var re = new RegExp('^\\s*(?:\\/\\*[\\s\\S]*?\\*\\/)\\s*');
var matches = contents.match( re );
return matches[0].replace( 'imagesLoaded', 'imagesLoaded PACKAGED' );
})();

grunt.initConfig({

requirejs: {
// create imagesloaded.pkgd.js
pkgd: {
options: {
baseUrl: 'bower_components',
include: [
'../imagesloaded'
],
out: 'imagesloaded.pkgd.js',
optimize: 'none',
wrap: {
start: banner
}
}
}
},

uglify: {
pkgd: {
files: {
'imagesloaded.pkgd.min.js': [ 'imagesloaded.pkgd.js' ]
},
options: {
banner: banner
}
}
},

});

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

grunt.registerTask( 'remove-pkgd-module-name', function() {
var contents = grunt.file.read('imagesloaded.pkgd.js');
contents = contents.replace( "'../imagesloaded',", '' );
grunt.file.write( 'imagesloaded.pkgd.js', contents );
grunt.log.writeln('Removed pkgd module name on imagesloaded.pkgd.js');
});

grunt.registerTask( 'default', [
'requirejs',
'remove-pkgd-module-name',
'uglify'
]);

};
5 changes: 3 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagesloaded",
"version": "3.1.4",
"version": "3.1.5",
"description": "JavaScript is all like _You images done yet or what?_",
"main": "imagesloaded.js",
"dependencies": {
Expand All @@ -15,6 +15,7 @@
"**/.*",
"test",
"component.json",
"imagesloaded.jquery.json"
"imagesloaded.jquery.json",
"package.json"
]
}
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "imagesloaded",
"repo": "desandro/imagesloaded",
"description": "JavaScript is all like _You images done yet or what?_",
"version": "3.1.4",
"version": "3.1.5",
"scripts": [
"imagesloaded.js"
],
Expand Down
2 changes: 1 addition & 1 deletion imagesloaded.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagesloaded",
"version": "3.1.4",
"version": "3.1.5",
"title": "imagesLoaded",
"description": "JavaScript is all like 'You images done yet or what?'",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion imagesloaded.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* imagesLoaded v3.1.4
* imagesLoaded v3.1.5
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
Expand Down
Loading

0 comments on commit 182e3e4

Please sign in to comment.