123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- module.exports = function(grunt) {
- // Load all grunt modules
- require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
- // Tell our Express server that Grunt launched it
- process.env.GRUNTED = true;
- // Project configuration.
- grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'),
- settings: grunt.file.readJSON('./server_config/settings.json'),
-
- less: {
- all: {
- files: [
- {
- expand: true,
- cwd: 'front/src/less/',
- src: ['**/*.less'],
- dest: 'front/src/css/',
- ext: '.css'
- }
- ]
- }
- },
- jshint: {
- all: [
- '*.js',
- 'app/lib/*.js',
- 'bin/*.js',
- 'lib/**/*.js',
- 'app/nodeControllers/*.js',
- 'app/public/scripts/*.js',
- 'phantomas_custom/**/*.js',
- 'test/api/*.js',
- 'test/core/*.js',
- 'test/fixtures/*.js',
- 'front/src/js/**/*.js'
- ],
- options: {
- esversion: 6
- }
- },
- clean: {
- tmp: {
- src: ['.tmp']
- },
- dev: {
- src: ['front/src/css']
- },
- build: {
- src: ['front/build']
- }
- },
- copy: {
- build: {
- files: [
- {src: ['./front/src/main.html'], dest: './front/build/main.html'},
- {src: ['./front/src/img/favicon.png'], dest: './front/build/img/favicon.png'},
- {src: ['./front/src/img/logo-large.png'], dest: './front/build/img/logo-large.png'},
- ]
- },
- favicons: {
- files: [
- {src: ['./front/src/img/favicon.png'], dest: './front/build/img/favicon.png'},
- {src: ['./front/src/img/favicon-fail.png'], dest: './front/build/img/favicon-fail.png'},
- {src: ['./front/src/img/favicon-success.png'], dest: './front/build/img/favicon-success.png'},
- ]
- }
- },
- mochaTest: {
- test: {
- options: {
- reporter: 'spec',
- },
- src: ['test/core/*.js', 'test/api/*.js']
- },
- 'test-current-work': {
- options: {
- reporter: 'spec',
- },
- src: ['test/core/mediaQueriesCheckerTest.js']
- }
- },
- env: {
- dev: {
- NODE_ENV: 'development'
- },
- built: {
- NODE_ENV: 'production'
- }
- },
- express: {
- dev: {
- options: {
- port: 8383,
- server: './bin/server.js',
- serverreload: true,
- showStack: true
- }
- },
- built: {
- options: {
- port: 8383,
- server: './bin/server.js',
- serverreload: true,
- showStack: true
- }
- },
- test: {
- options: {
- port: 8387,
- server: './bin/server.js',
- showStack: true
- }
- },
- 'test-current-work': {
- options: {
- port: 8387,
- server: './bin/server.js',
- showStack: true
- }
- },
- testSuite: {
- options: {
- port: 8388,
- bases: 'test/www'
- }
- }
- },
- useminPrepare: {
- html: './front/src/main.html',
- options: {
- dest: './front/build',
- root: ['./', './front/src']
- }
- },
- usemin: {
- html: './front/build/main.html',
- css: './front/build/css/*.css',
- options: {
- assetsDirs: ['front/build']
- }
- },
- htmlmin: {
- options: {
- removeComments: true,
- collapseWhitespace: true,
- conservativeCollapse: true
- },
- main: {
- files: [{
- expand: true,
- cwd: './front/build/',
- src: 'main.html',
- flatten: true,
- dest: './front/build'
- }]
- },
- views: {
- files: [{
- expand: true,
- cwd: './front/src/views',
- src: '*.html',
- flatten: true,
- dest: '.tmp/views/'
- }]
- }
- },
- inline_angular_templates: {
- build: {
- options: {
- base: '.tmp',
- method: 'append',
- unescape: {
- '<': '<',
- '>': '>'
- }
- },
- files: {
- './front/build/main.html': ['.tmp/views/*.html']
- }
- }
- },
- filerev: {
- options: {
- algorithm: 'md5',
- length: 8
- },
- assets: {
- src: './front/build/*/*.*'
- }
- }
- });
- // Custom task that sets a variable for tests
- grunt.registerTask('test-settings', function() {
- process.env.IS_TEST = true;
- });
- grunt.registerTask('build', [
- 'jshint',
- 'clean:build',
- 'copy:build',
- 'less',
- 'useminPrepare',
- 'concat',
- 'uglify',
- 'cssmin',
- 'htmlmin:views',
- 'inline_angular_templates',
- 'filerev',
- 'usemin',
- 'htmlmin:main',
- 'clean:tmp',
- 'copy:favicons'
- ]);
- grunt.registerTask('hint', [
- 'jshint'
- ]);
- grunt.registerTask('dev', [
- 'env:dev',
- 'express:dev'
- ]);
- grunt.registerTask('built', [
- 'env:built',
- 'express:built'
- ]);
- grunt.registerTask('test', [
- 'test-settings',
- 'build',
- 'express:testSuite',
- 'express:test',
- 'mochaTest:test',
- 'clean:tmp'
- ]);
- grunt.registerTask('test-current-work', [
- 'test-settings',
- 'jshint',
- 'express:testSuite',
- 'express:test-current-work',
- 'mochaTest:test-current-work',
- 'clean:tmp'
- ]);
- };
|