Skip to content

Commit

Permalink
manage envs to not copy references and apidocs in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeurant committed Feb 14, 2014
1 parent bdd13dc commit a7a230c
Showing 1 changed file with 95 additions and 87 deletions.
182 changes: 95 additions & 87 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,94 +1,102 @@
module.exports = function(grunt) {
module.exports = function (grunt) {

grunt.initConfig({
var env = grunt.option('env') || 'dev';

clean: {
jekyll: ['_site']
},
less: {
compile: {
options: {
paths: ['assets/stylesheets/less'],
yuicompress: true
},
files: {
'assets/stylesheets/css/main.css': 'assets/stylesheets/less/main.less'
}
}
},
copy: {
jquery: {
files: [
{expand: true, cwd: 'bower_components/jquery/', src: ['jquery.min.js'], dest: 'assets/javascript/'}
]
},
bootstrap: {
files: [
{expand: true, cwd: 'bower_components/bootstrap/dist/js/', src: ['bootstrap.min.js'], dest: 'assets/javascript/'},
{expand: true, cwd: 'bower_components/bootstrap/dist/fonts/', src: ['*'], dest: 'assets/stylesheets/fonts/'}
]
}
},
watch: {
styles: {
files: ['assets/stylesheets/less/*'],
tasks: ['create-site']
},
html: {
files: ['partials/*.html', '_layouts/*.html', '_includes/**/*.html', '*.html'],
tasks: ['create-site'],
options: {
interrupt: true
}
},
md: {
files: ['partials/*.md', '_includes/**/*.md', 'docs/**/*.md', 'news/*.md', '_posts/*.md'],
tasks: ['create-site'],
options: {
interrupt: true
}
},
javascript: {
files: ['assets/javascript/main.js'],
tasks: ['create-site'],
options: {
interrupt: true
}
}
},
jekyll: {
options: {
bundleExec: true,
src : '<%= app %>'
},
dist: {
options: {
dest: '_site',
config: '_config.yml'
}
}
},
connect: {
server: {
options: {
port: 4000,
base: '_site'
}
}
}
grunt.initConfig({

});
clean: {
jekyll: ['_site']
},
less: {
compile: {
options: {
paths: ['assets/stylesheets/less'],
yuicompress: true
},
files: {
'assets/stylesheets/css/main.css': 'assets/stylesheets/less/main.less'
}
}
},
copy: {
jquery: {
files: [
{expand: true, cwd: 'bower_components/jquery/', src: ['jquery.min.js'], dest: 'assets/javascript/'}
]
},
bootstrap: {
files: [
{expand: true, cwd: 'bower_components/bootstrap/dist/js/', src: ['bootstrap.min.js'], dest: 'assets/javascript/'},
{expand: true, cwd: 'bower_components/bootstrap/dist/fonts/', src: ['*'], dest: 'assets/stylesheets/fonts/'}
]
}
},
watch: {
styles: {
files: ['assets/stylesheets/less/*'],
tasks: ['create-site']
},
html: {
files: ['partials/*.html', '_layouts/*.html', '_includes/**/*.html', '*.html'],
tasks: ['create-site'],
options: {
interrupt: true
}
},
md: {
files: ['partials/*.md', '_includes/**/*.md', 'docs/**/*.md', 'news/*.md', '_posts/*.md'],
tasks: ['create-site'],
options: {
interrupt: true
}
},
javascript: {
files: ['assets/javascript/main.js'],
tasks: ['create-site'],
options: {
interrupt: true
}
}
},
jekyll: {
options: {
bundleExec: true,
src: '<%= app %>'
},
deploy: {
options: {
dest: '_site',
config: '_config.yml'
}
},
dev: {
options: {
dest: '_site',
config: '_config.yml',
raw: 'exclude: [package.json, bower.json, node_modules, bower_components, Gemfile, Gemfile.lock, less, Gruntfile.js, reference, apidocs, schema]\n'
}
}
},
connect: {
server: {
options: {
port: 4000,
base: '_site'
}
}
}

grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
});

grunt.registerTask('create-site', ['less:compile', 'copy', 'jekyll']);
grunt.registerTask('build-and-watch', ['connect', 'create-site', 'watch']);
grunt.registerTask('build', ['clean:jekyll', 'create-site']);
grunt.registerTask('default', ['build-and-watch']);
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');

grunt.registerTask('create-site', ['less:compile', 'copy', 'jekyll:'+env]);
grunt.registerTask('build-and-watch', ['connect', 'create-site', 'watch']);
grunt.registerTask('default', ['build-and-watch']);

};

0 comments on commit a7a230c

Please sign in to comment.