Last active
December 19, 2015 03:49
-
-
Save ricardodantas/5893289 to your computer and use it in GitHub Desktop.
Grunfile.js
This file contains hidden or 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
| module.exports = function(grunt) { | |
| // Project configuration. | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| uglify: { | |
| // options: { | |
| // banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | |
| // }, | |
| // build: { | |
| // src: 'public/javascripts/frontend/all.js', | |
| // dest: 'public/javascripts/frontend/all.min.js' | |
| // } | |
| build: { | |
| files: { | |
| 'public/javascripts/frontend/all.min.js': ['public/javascripts/frontend/*.js'], | |
| 'public/javascripts/backend/all.min.js': ['public/javascripts/backend/*.js'], | |
| 'public/javascripts/admin/all.min.js': ['public/javascripts/admin/*.js'] | |
| } | |
| } | |
| }, | |
| compass: { | |
| dist: { | |
| options: { | |
| //basePath: 'public', | |
| //config: 'html/_/config.rb', // css_dir = 'dev/css' | |
| sassDir: 'public/stylesheets/scss', | |
| cssDir: 'public/stylesheets/css', | |
| imagesDir: 'public/images', | |
| generatedImagesDir: 'public/images', | |
| javascriptsDir: 'public/javascripts', | |
| fontsDir: 'public/fonts', | |
| httpPath: '/', | |
| noLineComments: true, | |
| outputStyle: 'compressed', | |
| force: true, | |
| //relativeAssets: false | |
| } | |
| } | |
| }, | |
| /* | |
| pngmin: { | |
| compile: { | |
| options: { | |
| binary: '/usr/local/bin/pngquant', | |
| concurrency: 8, | |
| ext: '.png', | |
| quality: '70-80', | |
| speed: 10, | |
| force: true, | |
| iebug: true | |
| }, | |
| files: [ | |
| { | |
| src: 'public/images/frontend/*.png', | |
| dest: 'public/images/frontend/' | |
| } | |
| ] | |
| } | |
| }, | |
| */ | |
| imagemin: { | |
| png: { | |
| options: { | |
| optimizationLevel: 7 | |
| }, | |
| files: [ | |
| { | |
| expand: true, | |
| cwd: 'images/', | |
| src: ['**/*.png'], | |
| // Could also match cwd line above. i.e. project-directory/img/ | |
| dest: 'images_optimized/', | |
| ext: '.png' | |
| } | |
| ] | |
| }, | |
| jpg: { | |
| options: { | |
| progressive: true | |
| }, | |
| files: [ | |
| { | |
| expand: true, | |
| cwd: 'images/', | |
| src: ['**/*.jpg'], | |
| dest: 'images_optimized/', | |
| ext: '.jpg' | |
| } | |
| ] | |
| } | |
| }, | |
| concat: { | |
| options: { | |
| separator: ';' | |
| }, | |
| frontend_js: { | |
| src: ['public/javascripts/*.js'], | |
| dest: 'public/javascripts/frontend.js' | |
| } | |
| }, | |
| coffee: { | |
| compile: { | |
| options: { | |
| join: true | |
| }, | |
| files: { | |
| 'public/javascripts/frontend/all.js': ['public/javascripts/coffeescripts/frontend/*.coffee'], // compile and concat into single file | |
| 'public/javascripts/backend/all.js': ['public/javascripts/coffeescripts/backend/*.coffee'] // compile and concat into single file | |
| } | |
| }, | |
| }, | |
| js2coffee: { | |
| each: { | |
| options: {}, | |
| files: [{ | |
| expand: true, | |
| cwd: 'public/javascripts/js2coffee/', | |
| src: ['**/*.js'], | |
| dest: 'public/javascripts/coffeescripts', | |
| ext: '.coffee' | |
| }] | |
| } | |
| }, | |
| watch: { | |
| coffeescript: { | |
| files: ['public/javascripts/coffeescripts/**/*.coffee'], | |
| tasks: ['coffee:compile','uglify'], | |
| options:{ | |
| nospawn: false | |
| }, | |
| }, | |
| css: { | |
| files: ['public/stylesheets/scss/**/*.scss'], | |
| tasks: ['compass:dist'], | |
| options: { | |
| // Start a live reload server on the default port 35729 | |
| livereload: false, | |
| nospawn: false | |
| }, | |
| }, | |
| optimize_png: { | |
| files: ['public/images/**/*.png'], | |
| tasks: ['imagemin:png'], | |
| options: { | |
| nospawn: false | |
| } | |
| }, | |
| optimize_jpg: { | |
| files: ['public/images/**/*.jpg'], | |
| tasks: ['imagemin:jpg'], | |
| options: { | |
| nospawn: false | |
| } | |
| }, | |
| // frontend_js:{ | |
| // files: ['public/javascripts/**/*.js'], | |
| // task: ['concat:frontend_js'], | |
| // options: { | |
| // nospawn: true | |
| // } | |
| // }, | |
| } | |
| }); | |
| grunt.loadNpmTasks('grunt-contrib-coffee'); | |
| grunt.loadNpmTasks('grunt-js2coffee'); | |
| grunt.loadNpmTasks('grunt-contrib-concat'); | |
| grunt.loadNpmTasks('grunt-contrib-uglify'); | |
| grunt.loadNpmTasks('grunt-contrib-watch'); | |
| grunt.loadNpmTasks('grunt-contrib-compass'); | |
| //grunt.loadNpmTasks('grunt-contrib-jade'); | |
| //grunt.loadNpmTasks('grunt-pngmin'); | |
| grunt.loadNpmTasks('grunt-contrib-imagemin'); | |
| grunt.registerTask('default',['compass','coffee']); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment