1

Disting images, fixing up paths

This commit is contained in:
Alex Yatskov 2014-10-02 13:14:22 +09:00
parent ced1491bc8
commit 50d94a037b
2 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,7 @@ var inject = require('gulp-inject');
var jshint = require('gulp-jshint');
var minifyCss = require('gulp-minify-css');
var minifyHtml = require('gulp-minify-html');
var replace = require('gulp-replace');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
@ -27,6 +28,9 @@ var paths = {
fonts: [
'./bower_components/bootstrap/fonts/*'
],
images: [
'./images/*'
],
html: [
'./html/*.html'
]
@ -38,6 +42,11 @@ gulp.task('lint', function() {
.pipe(jshint.reporter('default'));
});
gulp.task('images', function() {
return gulp.src(paths.images)
.pipe(gulp.dest('./dist/images'));
});
gulp.task('fonts', function() {
return gulp.src(paths.fonts)
.pipe(gulp.dest('./dist/fonts'));
@ -52,6 +61,7 @@ gulp.task('scripts', function() {
gulp.task('styles', function() {
return gulp.src(paths.styles)
.pipe(replace('../fonts/', './fonts/'))
.pipe(concat('styles.css'))
.pipe(minifyCss())
.pipe(gulp.dest('./dist'));
@ -60,6 +70,7 @@ gulp.task('styles', function() {
gulp.task('html_debug', function() {
var sources = gulp.src(paths.scripts.concat(paths.styles), { read: false });
return gulp.src(paths.html)
.pipe(replace('images', '../images'))
.pipe(inject(sources, { addRootSlash: false, addPrefix: '..' }))
.pipe(gulp.dest('./dev'));
});
@ -77,6 +88,6 @@ gulp.task('watch_debug', function() {
});
gulp.task('debug', ['lint', 'html_debug']);
gulp.task('release', ['lint', 'fonts', 'scripts', 'styles', 'html_release']);
gulp.task('release', ['lint', 'fonts', 'images', 'scripts', 'styles', 'html_release']);
gulp.task('all', ['debug', 'release']);
gulp.task('default', ['html_debug', 'watch_debug']);

View File

@ -16,6 +16,7 @@
"gulp-minify-css": "^0.3.10",
"gulp-minify-html": "^0.1.5",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.4.0",
"gulp-sourcemaps": "^1.2.2",
"gulp-uglify": "^1.0.1",
"main-bower-files": "^2.0.0"