1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-23 01:30:09 +01:00
wp-theme/Gruntfile.js

187 lines
6.7 KiB
JavaScript
Raw Normal View History

2015-09-17 01:26:48 +02:00
module.exports = function( grunt ) {
2015-09-18 00:43:02 +02:00
// Project configuration
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
concat: {
options: {
stripBanners: true,
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n'
},
main: {
src: [
'assets/js/src/ascribe.js'
],
dest: 'assets/js/ascribe.js'
}
},
jshint: {
all: [
'Gruntfile.js',
'assets/js/src/**/*.js',
'assets/js/test/**/*.js'
]
},
uglify: {
all: {
files: {
'assets/js/ascribe.min.js': ['assets/js/ascribe.js']
},
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n',
mangle: {
except: ['jQuery']
}
}
}
},
2015-09-18 00:21:29 +02:00
less: {
all: {
options: {
sourceMap: false
},
files: {
'assets/css/ascribe.css': 'assets/css/less/ascribe.less'
}
}
},
2015-09-17 01:26:48 +02:00
2015-09-18 00:43:02 +02:00
postcss: {
dist: {
options: {
processors: [
require('autoprefixer-core')({browsers: 'last 2 versions'})
]
},
files: {
'assets/css/ascribe.css': [ 'assets/css/ascribe.css' ]
}
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%=pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n'
},
minify: {
expand: true,
cwd: 'assets/css/',
src: ['ascribe.css'],
dest: 'assets/css/',
ext: '.min.css'
}
},
watch: {
2015-10-16 05:27:03 +02:00
//livereload: {
// files: ['assets/css/*.css'],
// options: {
// livereload: true
// }
//},
2015-09-18 00:43:02 +02:00
styles: {
files: ['assets/css/less/**/*.less'],
2015-10-16 05:27:03 +02:00
tasks: ['less', 'postcss', 'cssmin'],
2015-09-18 00:43:02 +02:00
options: {
debounceDelay: 500
}
},
scripts: {
files: ['assets/js/src/**/*.js', 'assets/js/vendor/**/*.js'],
tasks: ['jshint', 'concat', 'uglify'],
options: {
debounceDelay: 500
}
}
2015-10-16 05:27:03 +02:00
},
'sftp-deploy': {
css: {
auth: {
host: 'server.territorial.ca',
port: 22,
authKey: 'key1'
},
cache: 'sftpCache.json',
src: '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/css/',
dest: '/home/ascribe/public_html/wp-content/themes/ascribe/assets/css',
exclusions: ['/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/node_modules',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/release',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/vendor',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.git',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.idea',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/**/.DS_Store'],
serverSep: '/',
concurrency: 4,
progress: true
},
js: {
auth: {
host: 'server.territorial.ca',
port: 22,
authKey: 'key1'
},
cache: 'sftpCache.json',
src: '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/assets/js/',
dest: '/home/ascribe/public_html/wp-content/themes/ascribe/assets/js',
exclusions: ['/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/node_modules',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/release',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/vendor',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.git',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.idea',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/**/.DS_Store'],
serverSep: '/',
concurrency: 4,
progress: true
},
controller: {
auth: {
host: 'server.territorial.ca',
port: 22,
authKey: 'key1'
},
cache: 'sftpCache.json',
src: '/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/controller/',
dest: '/home/ascribe/public_html/wp-content/themes/ascribe/controller/',
exclusions: ['/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/node_modules',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/release',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/vendor',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.git',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/.idea',
'/Users/sarahetter/Dropbox/_shared/sarahetter/ascribe/**/.DS_Store'],
serverSep: '/',
concurrency: 4,
progress: true
}
2015-09-18 00:21:29 +02:00
}
2015-09-18 00:43:02 +02:00
} );
// Load tasks
require('load-grunt-tasks')(grunt);
2015-09-17 01:26:48 +02:00
2015-09-18 00:43:02 +02:00
// Register tasks
2015-09-17 01:26:48 +02:00
2015-10-16 05:27:03 +02:00
grunt.registerTask( 'css', ['less', 'postcss', 'cssmin', 'sftp-deploy:css'] );
2015-09-17 01:26:48 +02:00
2015-10-16 05:27:03 +02:00
grunt.registerTask( 'js', ['jshint', 'concat', 'uglify', 'sftp-deploy:js'] );
2015-09-17 01:26:48 +02:00
2015-10-16 05:27:03 +02:00
grunt.registerTask( 'controller', ['sftp-deploy:controller'] );
2015-09-17 01:26:48 +02:00
2015-10-17 02:32:29 +02:00
grunt.registerTask( 'default', ['css', 'js', 'controller'] );
2015-09-17 01:26:48 +02:00
2015-09-18 00:43:02 +02:00
grunt.util.linefeed = '\n';
};