mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:05:49 +00:00
Using gulp for minifying CSS and JS
This commit is contained in:
parent
841116f196
commit
55312785d8
5 changed files with 56 additions and 6 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -12,7 +12,3 @@ target/
|
|||
|
||||
# Branch switching
|
||||
generated/
|
||||
|
||||
# Front-end client
|
||||
node_modules/
|
||||
bower_components/
|
3
springboot-petclinic-client/.gitignore
vendored
Normal file
3
springboot-petclinic-client/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
bower_components/
|
||||
npm-debug.log
|
42
springboot-petclinic-client/gulpfile.js
Normal file
42
springboot-petclinic-client/gulpfile.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
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>
|
||||
|
|
Loading…
Reference in a new issue