Skip to content
Snippets Groups Projects
Commit 55312785 authored by Antoine Rey's avatar Antoine Rey
Browse files

Using gulp for minifying CSS and JS

parent 841116f1
Branches
No related tags found
No related merge requests found
......@@ -12,7 +12,3 @@ target/
# Branch switching
generated/
# Front-end client
node_modules/
bower_components/
\ No newline at end of file
node_modules/
bower_components/
npm-debug.log
\ No newline at end of file
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var paths = {
"css" : "src/css/*",
"fonts" : "src/fonts/*",
"images" : "src/images/*",
"html" : "src/scripts/**/*.html",
"js" : "src/scripts/**/*.js",
"dist" : "target/dist/"
};
gulp.task('minify-css', function() {
return gulp.src(paths.css)
.pipe(cleanCSS())
.pipe(gulp.dest(paths.dist + 'css/'));
});
gulp.task('minify-js', function() {
return gulp.src(paths.js)
.pipe(uglify())
.pipe(gulp.dest(paths.dist + 'scripts/'));
});
gulp.task('copy-fonts', function() {
return gulp.src(paths.fonts)
.pipe(gulp.dest(paths.dist + 'fonts/'))
});
gulp.task('copy-html', function() {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.dist + 'scripts/'))
});
gulp.task('copy-images', function() {
return gulp.src(paths.images)
.pipe(gulp.dest(paths.dist + 'images/'))
});
gulp.task('default', ['minify-css', 'minify-js', 'copy-fonts',
'copy-html', 'copy-images'], function() {});
......@@ -2,6 +2,9 @@
"private": true,
"dependencies": {},
"devDependencies": {
"bower": "^1.7.9"
"bower": "^1.7.9",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.0.6",
"gulp-uglify": "^1.5.3"
}
}
......@@ -18,7 +18,7 @@
<build>
<resources>
<resource>
<directory>${basedir}/src</directory>
<directory>${project.build.directory}/dist</directory>
</resource>
<resource>
<directory>${basedir}/bower_components</directory>
......@@ -54,6 +54,12 @@
<goal>bower</goal>
</goals>
</execution>
<execution>
<id>gulp build</id>
<goals>
<goal>gulp</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment