I am new to Gulp. I am trying to create an issue in a folder dist. The structure of the project is as follows:
_untitled/
└── app/
└── img/
└── jade/
└── script/
└── style/
└── vendor/
└── 404.html
└── index.html
└── node_modules/
└── gulpfile.js
└── package.json
Here is my gulpfile.js:
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
gulp.task('jade', function () {
return gulp.src('app/jade/*.jade')
.pipe($.jade({
pretty: true
}))
.on('error', console.log)
.pipe(gulp.dest('app'))
.pipe($.size());
});
gulp.task('style', function () {
return gulp.src('app/style/sass/main.scss')
.pipe($.rubySass({
style: 'expanded',
'sourcemap=none': true,
noCache: true
}))
.pipe($.autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(gulp.dest('app/style'))
.pipe($.size());
});
gulp.task('script', function () {
return gulp.src('app/script/**/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter(require('jshint-stylish')))
.pipe($.size());
});
gulp.task('htmlDist', function () {
return gulp.src('app/**/*.html')
.pipe(gulp.dest('dist'))
.pipe($.size());
});
gulp.task('styleDist', function () {
return gulp.src('app/style/**/*.css')
.pipe($.concat('main.css'))
.pipe($.csso())
.pipe(gulp.dest('dist/style'))
.pipe($.size());
});
gulp.task('scriptDist', function () {
return gulp.src('app/script/**/*.js')
.pipe($.uglify())
.pipe(gulp.dest('dist/script'))
.pipe($.size());
});
gulp.task('cleanDist', function () {
var del = require('del');
return del('dist');
});
gulp.task('build', ['jade', 'style', 'script']);
gulp.task('buildDist', ['htmlDist', 'styleDist', 'scriptDist']);
gulp.task('release', ['cleanDist', 'build', 'buildDist']);
At the same time, when I type gulp release, I have ok dist, except that it is index.htmlempty and 0 KB. And then, when I try again to do it gulp release(the second time, with an existing folder dist), I only have a 404.htmlfile in the folder distand an error with the following output:
gulp release
[02:36:14] Using gulpfile D:\Coding\_untitled\gulpfile.js
[02:36:14] Starting 'cleanDist'...
[02:36:14] Finished 'cleanDist' after 52 ms
[02:36:14] Starting 'jade'...
[02:36:15] Starting 'style'...
[02:36:16] Starting 'script'...
[02:36:17] Starting 'htmlDist'...
[02:36:17] Starting 'styleDist'...
[02:36:17] Starting 'scriptDist'...
[02:36:17] all files 38 B
[02:36:17] Finished 'script' after 1.19 s
[02:36:17] all files 432 B
[02:36:17] Finished 'jade' after 2.88 s
stream.js:94
throw er;
^
Error: ENOENT, chmod 'D:\Coding\_untitled\dist\script\main.js'
, gulp release ( ), dist . , ( index.html), dist , . , , dist, . gulp buildDist (index.html ).
, , . .