Skip to content

Commit

Permalink
build for CDNJS
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Mar 30, 2013
1 parent f5b61eb commit 9b4bfc1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build/out
build/archive
build/component
build/cdn
dist

# for npm
Expand Down
45 changes: 40 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = function(grunt) {
// Parse config files
var lumbarConfig = grunt.file.readJSON('lumbar.json');
var packageConfig = grunt.file.readJSON('package.json');
var componentConfig = grunt.file.readJSON('component.json');
var pluginConfig = grunt.file.readJSON('fullcalendar.jquery.json');

// This will eventually get passed to grunt.initConfig()
Expand All @@ -28,8 +27,8 @@ module.exports = function(grunt) {
clean: {}
};

// Combine configs for the "meta" template variable (<%= meta.whatever %>)
config.meta = _.extend({}, packageConfig, componentConfig, pluginConfig);
// Combine certain configs for the "meta" template variable (<%= meta.whatever %>)
config.meta = _.extend({}, packageConfig, pluginConfig);

// The "grunt" command with no arguments
grunt.registerTask('default', 'archive');
Expand Down Expand Up @@ -179,7 +178,7 @@ module.exports = function(grunt) {
expand: true,
cwd: 'build/out/',
src: [ '*.js', '*.css', '!jquery*' ],
dest: 'build/component/',
dest: 'build/component/'
};

// copy the component-specific README
Expand All @@ -190,10 +189,11 @@ module.exports = function(grunt) {

// assemble the component's config from existing configs
grunt.registerTask('componentConfig', function() {
var config = grunt.file.readJSON('component.json');
grunt.file.write(
'build/component/component.json',
JSON.stringify(
_.extend({}, pluginConfig, componentConfig), // combine 2 configs
_.extend({}, pluginConfig, config), // combine 2 configs
null, // replacer
2 // indent
)
Expand All @@ -204,6 +204,41 @@ module.exports = function(grunt) {



/* CDN (http://cdnjs.com/)
----------------------------------------------------------------------------------------------------*/

grunt.registerTask('cdn', 'Build files for CDNJS\'s hosted version of FullCalendar', [
'clean:modules',
'clean:cdn',
'modules',
'copy:cdnModules',
'cdnConfig'
]);

config.copy.cdnModules = {
expand: true,
cwd: 'build/out/',
src: [ '*.js', '*.css', '!jquery*' ],
dest: 'build/cdn/<%= meta.version %>/'
};

grunt.registerTask('cdnConfig', function() {
var config = grunt.file.readJSON('cdn.json');
grunt.file.write(
'build/cdn/package.json',
JSON.stringify(
_.extend({}, pluginConfig, config), // combine 2 configs
null, // replace
2 // indent
)
);
});

config.clean.cdn = 'build/cdn/<%= meta.version %>/';
// NOTE: not a complete clean. also need to manually worry about package.json and version folders



// finally, give grunt the config object...
grunt.initConfig(config);
};
3 changes: 3 additions & 0 deletions cdn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"filename": "fullcalendar.min.js"
}

0 comments on commit 9b4bfc1

Please sign in to comment.