mirror of
https://gitlab.com/Oreolek/salet-module.git
synced 2024-06-26 03:50:49 +03:00
Gulpfile update
This commit is contained in:
parent
53d9009fc6
commit
3215b865f5
|
@ -10,25 +10,23 @@ sass = require('gulp-sass')
|
|||
uglify = require('gulp-uglify')
|
||||
buffer = require('vinyl-buffer')
|
||||
zip = require('gulp-zip')
|
||||
_ = require('lodash')
|
||||
concat = require('gulp-concat')
|
||||
|
||||
reload = browserSync.reload
|
||||
|
||||
html = (target) ->
|
||||
return () ->
|
||||
return gulp.src(['html/index.html','html/en.html'])
|
||||
.pipe(gulp.dest(target));
|
||||
return gulp.src(['html/index.html']).pipe(gulp.dest(target))
|
||||
|
||||
# Images
|
||||
img = (target) ->
|
||||
return () ->
|
||||
return gulp.src(['img/*.png', 'img/*.jpeg', 'img/*.jpg'])
|
||||
.pipe(gulp.dest(target));
|
||||
return gulp.src(['img/*.png', 'img/*.jpeg', 'img/*.jpg']).pipe(gulp.dest(target))
|
||||
|
||||
# Audio assets
|
||||
audio = (target) ->
|
||||
return () ->
|
||||
return gulp.src(['audio/*.mp3'])
|
||||
.pipe(gulp.dest(target));
|
||||
return gulp.src(['audio/*.mp3']).pipe(gulp.dest(target))
|
||||
|
||||
gulp.task('html', html('./build'))
|
||||
gulp.task('img', img('./build/img'))
|
||||
|
@ -37,21 +35,14 @@ gulp.task('audio', audio('./build/audio'))
|
|||
gulp.task('sass', () ->
|
||||
gulp.src('sass/main.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||
.pipe(gulp.dest('./build/css'));
|
||||
.pipe(gulp.dest('./build/css'))
|
||||
)
|
||||
|
||||
sources = [
|
||||
'./game/begin.coffee',
|
||||
'./game/story.coffee',
|
||||
'./game/init.coffee',
|
||||
]
|
||||
|
||||
opts = _.assign({}, watchify.args, {
|
||||
bundler = watchify(browserify({
|
||||
entries: ["./build/game/main.coffee"]
|
||||
debug: true
|
||||
transform: [coffeify]
|
||||
});
|
||||
bundler = watchify(browserify(opts))
|
||||
}))
|
||||
|
||||
bundle = () ->
|
||||
return bundler.bundle()
|
||||
|
@ -60,15 +51,16 @@ bundle = () ->
|
|||
.pipe(gulp.dest('./build/game'))
|
||||
|
||||
gulp.task('concatCoffee', () ->
|
||||
return gulp.src(sources)
|
||||
.pipe(concat('./main.coffee'))
|
||||
.pipe(gulp.dest('./build/game'))
|
||||
return gulp.src([
|
||||
'./game/begin.coffee',
|
||||
'./game/story.coffee',
|
||||
]).pipe(concat('./main.coffee')).pipe(gulp.dest('./build/game'))
|
||||
)
|
||||
|
||||
gulp.task('coffee', ['concatCoffee'], bundle)
|
||||
|
||||
bundler.on('update', bundle);
|
||||
bundler.on('log', gutil.log);
|
||||
bundler.on('update', bundle)
|
||||
bundler.on('log', gutil.log)
|
||||
|
||||
gulp.task('build', ['html', 'img', 'sass', 'coffee', 'audio'])
|
||||
|
||||
|
@ -85,7 +77,6 @@ gulp.task('serve', ['build'], () ->
|
|||
gulp.watch(['./html/*.html'], ['html'])
|
||||
gulp.watch(['./sass/*.scss'], ['sass'])
|
||||
gulp.watch(['./img/*.png', './img/*.jpeg', './img/*.jpg'], ['img'])
|
||||
gulp.watch(['./lib/*.coffee', './lib/*.js', './game/*.coffee'], ['coffee'])
|
||||
|
||||
gulp.watch(['./build/css/main.css'], sassListener)
|
||||
gulp.watch(
|
||||
|
@ -93,25 +84,25 @@ gulp.task('serve', ['build'], () ->
|
|||
browserSync.reload)
|
||||
)
|
||||
|
||||
gulp.task('html-dist', html('./dist'));
|
||||
gulp.task('img-dist', img('./dist/img'));
|
||||
gulp.task('audio-dist', audio('./dist/audio'));
|
||||
gulp.task('html-dist', html('./dist'))
|
||||
gulp.task('img-dist', img('./dist/img'))
|
||||
gulp.task('audio-dist', audio('./dist/audio'))
|
||||
gulp.task('legal-dist', () ->
|
||||
return gulp.src(['LICENSE.txt'])
|
||||
.pipe(gulp.dest("./dist"));
|
||||
);
|
||||
.pipe(gulp.dest("./dist"))
|
||||
)
|
||||
|
||||
gulp.task('sass-dist', () ->
|
||||
return gulp.src('./sass/main.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}))
|
||||
.pipe(gulp.dest('./dist/css'));
|
||||
);
|
||||
.pipe(gulp.dest('./dist/css'))
|
||||
)
|
||||
|
||||
distBundler = browserify({
|
||||
debug: false,
|
||||
entries: ['./build/game/main.coffee'],
|
||||
transform: ['coffeeify']
|
||||
});
|
||||
})
|
||||
|
||||
gulp.task('coffee-dist', ['concatCoffee'], () ->
|
||||
return distBundler.bundle()
|
||||
|
@ -119,13 +110,20 @@ gulp.task('coffee-dist', ['concatCoffee'], () ->
|
|||
.pipe(buffer())
|
||||
.pipe(uglify())
|
||||
.on('error', gutil.log)
|
||||
.pipe(gulp.dest('./dist/game'));
|
||||
);
|
||||
.pipe(gulp.dest('./dist/game'))
|
||||
)
|
||||
|
||||
gulp.task('dist', ['html-dist', 'img-dist', 'sass-dist', 'coffee-dist', 'audio-dist', 'legal-dist']);
|
||||
gulp.task('dist', [
|
||||
'html-dist',
|
||||
'img-dist',
|
||||
'sass-dist',
|
||||
'coffee-dist',
|
||||
'audio-dist',
|
||||
'legal-dist'
|
||||
])
|
||||
|
||||
gulp.task('zip', ['dist'], () ->
|
||||
return gulp.src('dist/**')
|
||||
.pipe(zip('dist.zip'))
|
||||
.pipe(gulp.dest('.'));
|
||||
);
|
||||
.pipe(gulp.dest('.'))
|
||||
)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
"gulp-zip": "^3.0.2",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-sass": "^2.1.1",
|
||||
"lodash": "^3.6.0",
|
||||
"vinyl-buffer": "^1.0.0",
|
||||
"vinyl-source-stream": "^1.1.0",
|
||||
"watchify": "^3.1.0"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 643bd8eaeb7a2a692fec3add22a3b61eff0fb62c
|
||||
Subproject commit 6384789f952c297356a94aded5900d199d09ae87
|
Loading…
Reference in a new issue