Skip to content

Commit 1de47aa

Browse files
Added more plugin s
1 parent a68892d commit 1de47aa

File tree

4 files changed

+50
-17
lines changed

4 files changed

+50
-17
lines changed

lib/config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,15 @@ module.exports = {
3636
title: 'Gulp',
3737
message: 'Error: <%= error.message %>'
3838
})
39-
}
39+
},
40+
banner: [
41+
`/**`,
42+
` * <%= pkg.name %> - <%= pkg.description %>`,
43+
` * @version v<%= pkg.version %>`,
44+
` * @license <%= pkg.license %>`,
45+
` * @copyright 2016 <%= pkg.author %>.`,
46+
` * @link <%= pkg.homepage %>`,
47+
` */`,
48+
``
49+
]
4050
}

lib/sass.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const merge = require('lodash').merge
44
const config = require('./config')
55
const $ = require('gulp-load-plugins')()
66
const path = require('path')
7+
const pkg = require('../package.json')
78

89
const defaults = {
910
taskname: 'sass',
@@ -17,6 +18,7 @@ const defaults = {
1718
beautifier: true,
1819
production: true,
1920
batchReplace: [],
21+
headerPackage: pkg,
2022
sassConfig: config.sassConfig,
2123
jsbeautifier: config.jsbeautifier,
2224
autoprefixer: config.autoprefixer,
@@ -35,6 +37,7 @@ module.exports = (gulp, options) => {
3537
const plumb = opts.plumb
3638
const dest = opts.dest
3739
const size = opts.size
40+
const headerPackage = opts.headerPackage
3841
const isProduction = opts.production
3942
const sassConfig = opts.sassConfig
4043
const jsbeautifier = opts.jsbeautifier
@@ -49,11 +52,11 @@ module.exports = (gulp, options) => {
4952
.pipe((!isProduction && beautifier)
5053
? $.jsbeautifier(jsbeautifier)
5154
: (minify && isProduction) ? $.cssnano() : $.util.noop())
52-
.pipe(isProduction
53-
? $.batchReplace(batchReplace) : $.util.noop())
55+
.pipe(isProduction ? $.batchReplace(batchReplace) : $.util.noop())
5456
.pipe((minify && isProduction) ? $.rename({
5557
suffix: '.min'
5658
}) : $.util.noop())
59+
.pipe($.header(config.banner.join('\n'), { headerPackage }))
5760
.pipe(gzip ? $.gzip({
5861
append: false
5962
}) : $.util.noop())

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"gulp-combine-mq": "^0.4.0",
5555
"gulp-cssnano": "^2.1.2",
5656
"gulp-gzip": "^1.4.0",
57+
"gulp-header": "^1.8.9",
5758
"gulp-jsbeautifier": "^2.0.4",
5859
"gulp-load-plugins": "^1.4.0",
5960
"gulp-notify": "^2.2.0",

yarn.lock

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,12 @@ concat-stream@^1.6.0:
613613
readable-stream "^2.2.2"
614614
typedarray "^0.0.6"
615615

616+
concat-with-sourcemaps@*:
617+
version "1.0.4"
618+
resolved "https://registry.yarnpkg.com/concat-with-sourcemaps/-/concat-with-sourcemaps-1.0.4.tgz#f55b3be2aeb47601b10a2d5259ccfb70fd2f1dd6"
619+
dependencies:
620+
source-map "^0.5.1"
621+
616622
config-chain@~1.1.5:
617623
version "1.1.11"
618624
resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2"
@@ -1627,6 +1633,15 @@ gulp-gzip@^1.4.0:
16271633
stream-to-array "~1.0.0"
16281634
through2 "^0.4.1"
16291635

1636+
gulp-header@^1.8.9:
1637+
version "1.8.9"
1638+
resolved "https://registry.yarnpkg.com/gulp-header/-/gulp-header-1.8.9.tgz#c9f10fee0632d81e939789c6ecf45a151bf3098b"
1639+
dependencies:
1640+
concat-with-sourcemaps "*"
1641+
gulp-util "*"
1642+
object-assign "*"
1643+
through2 "^2.0.0"
1644+
16301645
gulp-jsbeautifier@^2.0.4:
16311646
version "2.0.4"
16321647
resolved "https://registry.yarnpkg.com/gulp-jsbeautifier/-/gulp-jsbeautifier-2.0.4.tgz#df269894fab9e657d22407becd9bc79048c31514"
@@ -1692,20 +1707,7 @@ gulp-size@^2.1.0:
16921707
stream-counter "^1.0.0"
16931708
through2 "^2.0.0"
16941709

1695-
gulp-util@^2.2.14, gulp-util@~2.2.0:
1696-
version "2.2.20"
1697-
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-2.2.20.tgz#d7146e5728910bd8f047a6b0b1e549bc22dbd64c"
1698-
dependencies:
1699-
chalk "^0.5.0"
1700-
dateformat "^1.0.7-1.2.3"
1701-
lodash._reinterpolate "^2.4.1"
1702-
lodash.template "^2.4.1"
1703-
minimist "^0.2.0"
1704-
multipipe "^0.1.0"
1705-
through2 "^0.5.0"
1706-
vinyl "^0.2.1"
1707-
1708-
gulp-util@^3, gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.2, gulp-util@^3.0.6, gulp-util@^3.0.8:
1710+
gulp-util@*, gulp-util@^3, gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.2, gulp-util@^3.0.6, gulp-util@^3.0.8:
17091711
version "3.0.8"
17101712
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f"
17111713
dependencies:
@@ -1728,6 +1730,19 @@ gulp-util@^3, gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.2, gulp-util@^3.0
17281730
through2 "^2.0.0"
17291731
vinyl "^0.5.0"
17301732

1733+
gulp-util@^2.2.14, gulp-util@~2.2.0:
1734+
version "2.2.20"
1735+
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-2.2.20.tgz#d7146e5728910bd8f047a6b0b1e549bc22dbd64c"
1736+
dependencies:
1737+
chalk "^0.5.0"
1738+
dateformat "^1.0.7-1.2.3"
1739+
lodash._reinterpolate "^2.4.1"
1740+
lodash.template "^2.4.1"
1741+
minimist "^0.2.0"
1742+
multipipe "^0.1.0"
1743+
through2 "^0.5.0"
1744+
vinyl "^0.2.1"
1745+
17311746
gulp@^3.9.1:
17321747
version "3.9.1"
17331748
resolved "https://registry.yarnpkg.com/gulp/-/gulp-3.9.1.tgz#571ce45928dd40af6514fc4011866016c13845b4"
@@ -3008,6 +3023,10 @@ oauth-sign@~0.8.1:
30083023
version "0.8.2"
30093024
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
30103025

3026+
object-assign@*:
3027+
version "4.1.1"
3028+
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
3029+
30113030
object-assign@^3.0.0:
30123031
version "3.0.0"
30133032
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"

0 commit comments

Comments
 (0)