diff options
Diffstat (limited to 'gulpfile.babel.js')
-rw-r--r-- | gulpfile.babel.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gulpfile.babel.js b/gulpfile.babel.js index ad8adda2e..cea42d6c9 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js | |||
@@ -7,11 +7,20 @@ import { exec } from 'child_process'; | |||
7 | import dotenv from 'dotenv'; | 7 | import dotenv from 'dotenv'; |
8 | import sassVariables from 'gulp-sass-variables'; | 8 | import sassVariables from 'gulp-sass-variables'; |
9 | import { removeSync } from 'fs-extra'; | 9 | import { removeSync } from 'fs-extra'; |
10 | import kebabCase from 'kebab-case'; | ||
11 | import hexRgb from 'hex-rgb'; | ||
10 | 12 | ||
11 | import config from './package.json'; | 13 | import config from './package.json'; |
12 | 14 | ||
15 | import * as rawStyleConfig from './src/theme/default/legacy.js'; | ||
16 | |||
13 | dotenv.config(); | 17 | dotenv.config(); |
14 | 18 | ||
19 | const styleConfig = Object.keys(rawStyleConfig).map((key) => { | ||
20 | const isHex = /^#[0-9A-F]{6}$/i.test(rawStyleConfig[key]); | ||
21 | return ({ [`$raw_${kebabCase(key)}`]: isHex ? hexRgb(rawStyleConfig[key], { format: 'array' }).splice(0, 3).join(',') : rawStyleConfig[key] }); | ||
22 | }); | ||
23 | |||
15 | const paths = { | 24 | const paths = { |
16 | src: 'src', | 25 | src: 'src', |
17 | dest: 'build', | 26 | dest: 'build', |
@@ -83,9 +92,9 @@ export function html() { | |||
83 | 92 | ||
84 | export function styles() { | 93 | export function styles() { |
85 | return gulp.src(paths.styles.src) | 94 | return gulp.src(paths.styles.src) |
86 | .pipe(sassVariables({ | 95 | .pipe(sassVariables(Object.assign({ |
87 | $env: process.env.NODE_ENV === 'development' ? 'development' : 'production', | 96 | $env: process.env.NODE_ENV === 'development' ? 'development' : 'production', |
88 | })) | 97 | }, ...styleConfig))) |
89 | .pipe(sass({ | 98 | .pipe(sass({ |
90 | includePaths: [ | 99 | includePaths: [ |
91 | './node_modules', | 100 | './node_modules', |