I created a bootstrap-compass project with the following yeoman generator:
https://www.npmjs.com/package/generator-bootstrap-compass
You can see the file structure in the link.
How do I add the javascripts to this gruntfile correctly?
The gruntfile.js looks like this:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: {
app: 'app'
},
connect: {
options: {
port: 9000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= config.app %>/public'
]
}
},
},
watch: {
options: {
livereload: true,
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= config.app %>/public/{,*/}*.html',
'<%= config.app %>/public/css/{,*/}*.css',
'<%= config.app %>/public/images/{,*/}*'
]
},
compass: {
files: ['**/*.{scss,sass}'],
tasks: ['compass:dev']
},
},
compass: {
dev: {
options: {
sassDir: ['app/src/stylesheets'],
cssDir: ['app/public/css'],
environment: 'development'
}
},
prod: {
options: {
sassDir: ['app/src/stylesheets'],
cssDir: ['app/public/css'],
environment: 'production'
}
},
}
});
// Load the plugin
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
grunt.registerTask('default', ['connect:livereload', 'compass:dev', 'watch']);
// prod build
grunt.registerTask('prod', ['compass:prod']);
};
EDIT:
Solution:
I just added grunt-contrib-uglify and the following code to my gruntfile.js to compress any js codes in my project:
uglify: {
all: {
files: {
'<%= config.app %>/public/js/bootstrap.min.js': ['<%= config.app %>/src/javascripts/bootstrap.js']
}
},
}
there is a very short and interesting video explaining how Grunt works https://www.youtube.com/watch?v=TMKj0BxzVgw. But if you can't watch it right now, read this http://gruntjs.com/creating-tasks
I hope I have helped.