1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-06-01 03:30:18 -07:00

Minify assets on production

This commit is contained in:
Unknown 2017-06-02 12:27:41 +02:00
parent b97d9fd8b5
commit 011bb177c9
3 changed files with 13 additions and 7 deletions

View File

@ -37,7 +37,7 @@ For full requirements see Symfony 3.2 [docs](http://symfony.com/doc/3.2/referenc
#### Front-end #### Front-end
1. Install dependencies via [npm](https://www.npmjs.com/), `$ npm install` 1. Install dependencies via [npm](https://www.npmjs.com/), `$ npm install`
2. Install bower dependencies via [bower](https://bower.io), `$ bower install` 2. Install bower dependencies via [bower](https://bower.io), `$ bower install`
3. Compile assets by running [Gulp](http://gulpjs.com/), `$ gulp` 3. Compile assets by running [Gulp](http://gulpjs.com/), `$ gulp default [--env production]`
#### Initialization #### Initialization

View File

@ -12,21 +12,22 @@ gulp.task('css', function() {
]) ])
.pipe(plugins.sass().on('error', plugins.sass.logError)) .pipe(plugins.sass().on('error', plugins.sass.logError))
.pipe(plugins.concat('main.css', {newLine: ' '})) .pipe(plugins.concat('main.css', {newLine: ' '}))
.pipe(plugins.environments.production(plugins.cssmin()))
.pipe(gulp.dest('web/resources/css')); .pipe(gulp.dest('web/resources/css'));
}); });
gulp.task('three', function() { gulp.task('three', function() {
gulp.src([ gulp.src([
'bower_components/three/build/three.js', 'bower_components/three.js/build/three.js',
'bower_components/three/examples/js/libs/stats.min.js', 'bower_components/three.js/examples/js/libs/stats.min.js',
'bower_components/three/examples/js/loaders/STLLoader.js', 'bower_components/three.js/examples/js/loaders/STLLoader.js',
'bower_components/three/examples/js/Detector.js', 'bower_components/three.js/examples/js/Detector.js',
]) ])
.pipe(plugins.concat('three.js')) .pipe(plugins.concat('three.js'))
.pipe(gulp.dest('web/resources/js')); .pipe(gulp.dest('web/resources/js'));
gulp.src([ gulp.src([
'bower_components/three/examples/js/controls/OrbitControls.js', 'bower_components/three.js/examples/js/controls/OrbitControls.js',
]) ])
.pipe(plugins.concat('OrbitControls.js')) .pipe(plugins.concat('OrbitControls.js'))
.pipe(gulp.dest('web/resources/js')); .pipe(gulp.dest('web/resources/js'));
@ -44,6 +45,7 @@ gulp.task('js', function() {
'app/Resources/assets/js/**.js', 'app/Resources/assets/js/**.js',
]) ])
.pipe(plugins.concat('main.js')) .pipe(plugins.concat('main.js'))
.pipe(plugins.environments.production(plugins.uglify()))
.pipe(gulp.dest('web/resources/js')); .pipe(gulp.dest('web/resources/js'));
}); });

View File

@ -6,13 +6,17 @@
"dependencies": { "dependencies": {
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0",
"gulp-load-plugins": "^1.4.0", "gulp-load-plugins": "^1.4.0",
"gulp-newer": "^1.3.0", "gulp-newer": "^1.3.0",
"gulp-sass": "^2.3.2", "gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^2.6.0",
"gulp-uglify": "^3.0.0",
"gulp-watch": "^4.3.11", "gulp-watch": "^4.3.11",
"jquery": "^3.2.1", "jquery": "^3.2.1",
"lightbox2": "^2.9.0", "lightbox2": "^2.9.0",
"semantic-ui": "^2.2.9" "semantic-ui": "^2.2.9",
"gulp-environments": "^0.1.2"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {