@@ -66,10 +66,7 @@ const buildCssTask = function (cb) {
6666 gulpIf (
6767 conf . minify ,
6868 `sass --load-path=node_modules/ src/site.scss:${ conf . distPath } /css/site.css src/scss:${ conf . distPath } /vendor/css src/fonts:${ conf . distPath } /vendor/fonts src/libs:${ conf . distPath } /vendor/libs --style compressed --no-source-map` ,
69- gulpIf (
70- conf . fastDev ,
71- `sass --load-path=node_modules/ src/site.scss:${ conf . distPath } /css/site.css src/scss:${ conf . distPath } /vendor/css src/scss/pages:${ conf . distPath } /vendor/css/pages src/fonts:${ conf . distPath } /vendor/fonts src/libs:${ conf . distPath } /vendor/libs --no-source-map`
72- )
69+ `sass --load-path=node_modules/ src/site.scss:${ conf . distPath } /css/site.css src/scss:${ conf . distPath } /vendor/css src/fonts:${ conf . distPath } /vendor/fonts src/libs:${ conf . distPath } /vendor/libs --no-source-map`
7370 ) ,
7471 function ( err ) {
7572 cb ( err ) ;
@@ -146,58 +143,35 @@ const pageJsTask = function () {
146143 . pipe ( dest ( conf . distPath + `/js` ) ) ;
147144} ;
148145
149- // Build fonts
146+ // Iconify task
150147// -------------------------------------------------------------------------------
148+ const buildIconifyTask = function ( cb ) {
149+ // Create required directories without copying files
150+ const fs = require ( 'fs' ) ;
151+ const directories = [ './src/fonts/iconify' , './src/fonts' ] ;
152+
153+ directories . forEach ( dir => {
154+ if ( ! fs . existsSync ( dir ) ) {
155+ fs . mkdirSync ( dir , { recursive : true } ) ;
156+ }
157+ } ) ;
151158
152- const FONT_TASKS = [
153- {
154- name : 'remixicon' ,
155- path : [
156- 'node_modules/remixicon/fonts/remixicon.eot' ,
157- 'node_modules/remixicon/fonts/remixicon.ttf' ,
158- 'node_modules/remixicon/fonts/remixicon.woff' ,
159- 'node_modules/remixicon/fonts/remixicon.woff2' ,
160- 'node_modules/remixicon/fonts/remixicon.svg'
161- ]
162- }
163- ] . reduce ( function ( tasks , font ) {
164- const functionName = `buildFonts${ font . name . replace ( / ^ ./ , m => m . toUpperCase ( ) ) } Task` ;
165- const taskFunction = function ( ) {
166- // return src(root(font.path))
167- return (
168- src ( font . path )
169- // .pipe(dest(normalize(path.join(conf.distPath, 'fonts', font.name))))
170- . pipe ( dest ( path . join ( conf . distPath + `/vendor/` , 'fonts' , font . name ) ) )
171- ) ;
172- } ;
173-
174- Object . defineProperty ( taskFunction , 'name' , {
175- value : functionName
159+ const iconify = require ( 'child_process' ) . spawn ( 'node' , [ './src/fonts/iconify/iconify.js' ] , {
160+ cwd : __dirname
176161 } ) ;
177162
178- return tasks . concat ( [ taskFunction ] ) ;
179- } , [ ] ) ;
180-
181- // Formula module requires KaTeX - Quill Editor
182- const KATEX_FONT_TASK = [
183- {
184- name : 'katex' ,
185- path : 'node_modules/katex/dist/fonts/*'
186- }
187- ] . reduce ( function ( tasks , font ) {
188- const functionName = `buildFonts${ font . name . replace ( / ^ ./ , m => m . toUpperCase ( ) ) } Task` ;
189- const taskFunction = function ( ) {
190- return src ( font . path ) . pipe ( dest ( path . join ( conf . distPath , 'vendor/libs/quill/fonts' ) ) ) ;
191- } ;
192-
193- Object . defineProperty ( taskFunction , 'name' , {
194- value : functionName
163+ iconify . stdout . on ( 'data' , data => {
164+ console . log ( data . toString ( ) ) ;
195165 } ) ;
196166
197- return tasks . concat ( [ taskFunction ] ) ;
198- } , [ ] ) ;
167+ iconify . stderr . on ( 'data' , data => {
168+ console . error ( data . toString ( ) ) ;
169+ } ) ;
199170
200- const buildFontsTask = parallel ( FONT_TASKS , KATEX_FONT_TASK ) ;
171+ iconify . on ( 'close' , code => {
172+ cb ( ) ;
173+ } ) ;
174+ } ;
201175
202176// Clean build directory
203177// -------------------------------------------------------------------------------
@@ -228,7 +202,7 @@ const watchTask = function () {
228202// -------------------------------------------------------------------------------
229203const buildJsTask = series ( webpackJsTask , pageJsTask ) ;
230204
231- const buildTasks = [ buildCssTask , buildJsTask , buildFontsTask ] ;
205+ const buildTasks = [ buildCssTask , buildJsTask , buildIconifyTask ] ;
232206const buildTask = conf . cleanDist
233207 ? series ( cleanAllTask , parallel ( buildTasks ) )
234208 : series ( cleanAllTask , cleanSourcemapsTask , parallel ( buildTasks ) ) ;
@@ -240,8 +214,7 @@ module.exports = {
240214 clean : cleanAllTask ,
241215 'build:js' : buildJsTask ,
242216 'build:css' : buildCssTask ,
243- 'build:fonts' : buildFontsTask ,
244- // 'build:ren': renameTask,
217+ 'build:iconify' : buildIconifyTask ,
245218 build : buildTask ,
246219 watch : watchTask
247220} ;
0 commit comments