-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add grunt file to generate pkgd files
Fixes #127 tick version v3.1.5
- Loading branch information
Showing
8 changed files
with
992 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
]); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.