grunt-browser-sync
and grunt-contrib-copy
by making the changes as shown below to the existing Gruntfile.js:module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
less: {
files: ['webroot/WEB-INF/_ui-src/shared/less/variableMapping.less','webroot/WEB-INF/_ui-src/shared/less/generatedVariables.less',
'webroot/WEB-INF/_ui-src/responsive/lib/ybase-*/less/*', 'webroot/WEB-INF/_ui-src/**/themes/**/less/*.less'],
tasks: ['less'],
},
fonts: {
files: ['webroot/WEB-INF/_ui-src/**/themes/**/fonts/*'],
tasks: ['sync:syncfonts'],
},
ybasejs: {
files: ['webroot/WEB-INF/_ui-src/responsive/lib/ybase-0.1.0/js/**/*.js'],
tasks: ['copy'],
},
jquery: {
files: ['webroot/WEB-INF/_ui-src/responsive/lib/common/**.js'],
tasks: ['copy'],
},
},
less: {
default: {
files: [
{
expand: true,
cwd: 'webroot/WEB-INF/_ui-src/',
src: '**/themes/**/less/style.less',
dest: 'webroot/_ui/',
ext: '.css',
rename:function(dest,src){
var nsrc = src.replace(new RegExp("/themes/(.*)/less"),"/theme-$1/css");
return dest+nsrc;
}
}
]
},
},
sync : {
syncfonts: {
files: [{
expand: true,
cwd: 'webroot/WEB-INF/_ui-src/',
src: '**/themes/**/fonts/*',
dest: 'webroot/_ui/',
rename:function(dest,src){
var nsrc = src.replace(new RegExp("/themes/(.*)"),"/theme-$1");
return dest+nsrc;
}
}]
},
syncybase: {
files: [{
cwd: 'webroot/WEB-INF/_ui-src/responsive/lib/ybase-0.1.0/js/',
src: '**/*.js',
dest: 'webroot/_ui/responsive/common/js',
}]
},
syncjquery: {
files: [{
expand: true,
cwd: 'webroot/WEB-INF/_ui-src/responsive/lib',
src: 'jquery*.js',
dest: 'webroot/_ui/responsive/common/js',
}]
}
},
copy: {
main: {
files: [
// includes files within path and its sub-directories
{
expand: true,
cwd: 'webroot/WEB-INF/_ui-src/responsive/lib/ybase-0.1.0/js/',
src: '**/*.js',
dest: 'webroot/_ui/responsive/common/js'
},
{
expand: true,
cwd: 'webroot/WEB-INF/_ui-src/responsive/lib/common',
src: '**/*.js',
dest: 'webroot/_ui/responsive/common/js'
}
]
}
},
browserSync: {
default_options: {
bsFiles: {
src: [
"**/*.js",
"**/*.css",
"**/*.jsp",
"**/*.tag",
]
},
options: {
watchTask: true,
proxy: "https://local.dev:9002/customb2cutilstorefront",
reloadDelay: 2000
}
}
},
});
// Plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-sync');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s). Run 'grunt watch' to start the watching task or add 'watch' to the task list and run 'grunt'.
grunt.registerTask('default', ['less', 'sync']);
// Browser sync task
grunt.registerTask("server", ['browserSync', 'watch']);
};
proxy: "https://local.dev:9002/customb2cutilstorefront",
grunt-browser-sync
and grunt-contrib-copy
{
"name": "customb2cutilstorefront",
"version": "0.0.0",
"description": "grunt config for the accelerator",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "grunt"
},
"author": "",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "^0.6.1",
"plugin": "^0.3.3"
},
"dependencies": {
"grunt-browser-sync": "^2.2.0",
"grunt-sync": "0.0.8"
}
}
grunt-cli
[https://gruntjs.com/using-the-cli] is installed on your system. Run command,npm install
grunt server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
6 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |