|
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', 'app/scripts/*.js', 'app/scripts/**/*.js', 'test/**/*.js'],
options: {
globals: {
jQuery: true
}
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
},
concat: {
options: {
// define a string to put between each file in the concatenated output
separator: ';'
},
dist: {
// the files to concatenate
src: ['app/scripts/*.js', 'app/scripts/**/*.js'],
// the location of the resulting JS file
dest: 'dist/js/app.js'
}
},
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
mangle: false
},
dist: {
files: {
'dist/js/app.min.js': ['<%= concat.dist.dest %>']
}
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'dist/css/styles.css': ['app/styles/*.css']
}
}
},
qunit: {
files: ['test/**/*.html']
},
bower: {
dist: {
dest: 'dist/lib/'
}
},
copy: {
dist: {
files: [
{src: ['app/index.html'], dest: 'dist/index.html', filter: 'isFile'},
{src: ['app/data.json'], dest: 'dist/data.json', filter: 'isFile'},
{expand: true, flatten: false, cwd: 'app/views/', src: ['**'], dest: 'dist/views/', filter: 'isFile'},
{expand: true, flatten: false, cwd: 'app/content/', src: ['**'], dest: 'dist/content/', filter: 'isFile'}
]
}
},
wiredep: {
task: {
// Point to the files that should be updated when
// you run `grunt wiredep`
src: [
'app/*.html',
'app/views/**/*.html', // .html support...
'app/views/**/*.jade', // .jade support...
'app/styles/main.scss', // .scss & .sass support...
'app/config.yml' // and .yml & .yaml support out of the box!
],
options: {
// See wiredep's configuration documentation for the options
// you may pass:
// https://github.com/taptapship/wiredep#configuration
}
}
},
filerev: {
options: {
algorithm: 'md5',
length: 8
},
images: {
src: 'app/content/images/*.{jpg,jpeg,gif,png,webp}',
dest: 'dist/content/images'
},
videos: {
src: 'app/content/videos/*.mov',
dest: 'dist/content/videos'
}
},
serve: {
options: {
port: 8000,
},
dist: {
path: '/dist'
}
},
useminPrepare: {
html: 'dist/index.html',
options: {
dest: 'dist/'
}
},
usemin: {
html: 'dist/index.html',
options: {
assetsDirs: ['dist/js', 'dist/css', 'dist/content']
}
},
'sftp-deploy': {
build: {
auth: {
host: '162.243.124.54',
port: 22,
authKey: 'key1'
},
cache: 'sftpCache.json',
src: 'dist',
dest: '/var/www/portfolio-go/public_html/',
exclusions: ['/dist/**/.DS_Store', '/dist/**/Thumbs.db', 'dist/tmp'],
serverSep: '/',
concurrency: 4,
progress: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-wiredep');
grunt.loadNpmTasks('grunt-serve');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-bower');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-filerev');
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-sftp-deploy');
grunt.registerTask('build', [
'jshint',
'copy',
'useminPrepare',
'concat:generated',
'uglify:generated',
'cssmin:target',
'usemin',
]);
grunt.registerTask('deploy', [
'build',
'sftp-deploy'
]);
};
|