Skip to content

Commit f568bd0

Browse files
committed
chore(*): file naming based on package.json
1 parent b0eb32b commit f568bd0

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

gulpfile.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ var gulp = require('gulp'),
44
map = require('map-stream'),
55
plugins = require('gulp-load-plugins')(),
66
server = require('tiny-lr')(),
7-
config = require('./config.json');
7+
config = require('./config.json'),
8+
pkg = require('./package.json');
89

910

1011

@@ -21,10 +22,10 @@ var fnSass = function (path) {
2122
}))
2223
.pipe(plugins.autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4', {
2324
map: true,
24-
from: 'main.css',
25-
to: 'main.css'
25+
from: pkg.name + '-' + pkg.version + '.css',
26+
to: pkg.name + '-' + pkg.version + '.css'
2627
}))
27-
.pipe(plugins.concat('main.css'))
28+
.pipe(plugins.concat(pkg.name + '-' + pkg.version + '.css'))
2829
.pipe(gulp.dest(config.build + '/assets'));
2930
};
3031
gulp.task('styles:sass', function () {
@@ -79,7 +80,7 @@ var fnCacheTpls = function (path) {
7980
quotes: true
8081
}))
8182
.pipe(plugins.angularTemplatecache({
82-
module: 'ngDevstack.templates',
83+
module: pkg.name + '.templates',
8384
standalone: true
8485
}))
8586
.pipe(plugins.concat('templates.js'))
@@ -111,7 +112,7 @@ gulp.task('scripts:lint', function () {
111112
gulp.task('scripts', ['scripts:lint', 'scripts:cacheTpls', 'vendor:js'], function () {
112113
var arr = (config.vendor_files.js).concat(config.paths.scripts, config.build + '/app/templates.js');
113114
return gulp.src(arr)
114-
.pipe(plugins.concat('main.js'))
115+
.pipe(plugins.concat(pkg.name + '-' + pkg.version + '.js'))
115116
.pipe(plugins.size({ showFiles: true, title: '[JS]' }))
116117
.pipe(plugins.ngmin())
117118
.pipe(plugins.uglify({
@@ -177,8 +178,8 @@ gulp.task('html:inject', ['styles:sass', 'scripts:lint', 'scripts:cacheTpls'], f
177178
gulp.task('html:replace', ['html:inject'], function () {
178179
return gulp.src(config.build + '/index.html')
179180
.pipe(plugins.htmlReplace({
180-
css: 'assets/main.min.css',
181-
js: 'assets/main.min.js'
181+
css: 'assets/' + pkg.name + '-' + pkg.version + '.min.css',
182+
js: 'assets/' + pkg.name + '-' + pkg.version + '.min.js'
182183
}))
183184
.pipe(gulp.dest(config.dist));
184185
});

0 commit comments

Comments
 (0)