123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- /**
- * Created by robin on 11/10/15.
- */
-
- module.exports = function(grunt) {
-
- grunt.loadNpmTasks('grunt-contrib-clean');
- grunt.loadNpmTasks('grunt-usemin');
- grunt.loadNpmTasks('grunt-contrib-concat');
- grunt.loadNpmTasks('grunt-contrib-uglify');
- grunt.loadNpmTasks('grunt-contrib-copy');
- grunt.loadNpmTasks('grunt-contrib-cssmin');
- grunt.loadNpmTasks('grunt-contrib-less');
-
- var path = require('path');
-
- grunt.initConfig({
- globals: {
- releasePath: 'build/release/camotion',
- appFolder: 'camotion',
- staticFiles: [
- 'views/**/*.html',
- 'index.html',
- 'img/**',
- 'fonts/**'
- ]
- },
- useminPrepare: {
- release: '<%= globals.appFolder %>/index.html',
- options: {
- flow: {
- release: {
- steps: {
- 'js': [
- 'concat',
- {
- name: 'uglify',
- createConfig: function (context, block) {
- var cfg = {files: []},
- filesDef = {};
-
-
- filesDef.dest = path.join('<%= globals.releasePath %>', block.dest);
- filesDef.src = [];
- context.inFiles.forEach(function (inFile) {
- filesDef.src.push(path.join(context.inDir, inFile));
- });
-
- cfg.files.push(filesDef);
- return cfg;
- }
- }
- ],
- 'css': ['concat',
- {
- name: 'cssmin',
- createConfig: function (context, block) {
- var cfg = {files: []},
- filesDef = {};
-
-
- filesDef.dest = path.join('<%= globals.releasePath %>', block.dest);
- filesDef.src = [];
- context.inFiles.forEach(function (inFile) {
- filesDef.src.push(path.join(context.inDir, inFile));
- });
-
- cfg.files.push(filesDef);
- return cfg;
- }
- }],
- 'less': [
- {
- name: 'less',
- createConfig: function (context, block) {
- var cfg = {files: []},
- filesDef = {};
-
- context.options.generated.options = {
- cleancss: true
- };
-
- filesDef.dest = path.join('<%= globals.releasePath %>', block.dest);
- filesDef.src = [];
- context.inFiles.forEach(function (inFile) {
- filesDef.src.push(path.join(context.inDir, inFile));
- });
-
- cfg.files.push(filesDef);
- return cfg;
- }
- }
- ]
- },
- post: {
-
- }
- }
- }
- }
- },
- usemin: {
- html: '<%= globals.releasePath %>/index.html',
- options: {
- blockReplacements: {
- less: function (block) {
- return '<link rel=\"stylesheet\" href=\"' + block.dest + '\"/>';
- }
- }
- }
- },
- copy: {
- release: {
- files: [
- {
- expand: true,
- cwd:'<%= globals.appFolder %>/',
- src: ['<%= globals.staticFiles %>'],
- dest: '<%= globals.releasePath %>'
- },
- {
- expand: true,
- cwd:'<%= globals.appFolder %>/../bower_components/flat-ui/dist/fonts/',
- src: ['**'],
- dest: '<%= globals.releasePath %>/fonts/'
- }
- ]
- }
- },
- clean: {
- release: ['<%= globals.releasePath %>/*']
- }
- });
- grunt.registerTask('release', [
- 'clean:release',
- 'useminPrepare:release',
- 'concat:generated',
- 'uglify:generated',
- 'copy:release',
- 'cssmin:generated',
- 'less:generated',
- 'usemin'
- ]);
-
-
- };
|