@@ -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,52 +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 : 'boxicons' ,
155- path : 'node_modules/boxicons/fonts/*'
156- }
157- ] . reduce ( function ( tasks , font ) {
158- const functionName = `buildFonts${ font . name . replace ( / ^ ./ , m => m . toUpperCase ( ) ) } Task` ;
159- const taskFunction = function ( ) {
160- // return src(root(font.path))
161- return (
162- src ( font . path )
163- // .pipe(dest(normalize(path.join(conf.distPath, 'fonts', font.name))))
164- . pipe ( dest ( path . join ( conf . distPath + `/vendor/` , 'fonts' , font . name ) ) )
165- ) ;
166- } ;
167-
168- Object . defineProperty ( taskFunction , 'name' , {
169- value : functionName
159+ const iconify = require ( 'child_process' ) . spawn ( 'node' , [ './src/fonts/iconify/iconify.js' ] , {
160+ cwd : __dirname
170161 } ) ;
171162
172- return tasks . concat ( [ taskFunction ] ) ;
173- } , [ ] ) ;
174-
175- // Formula module requires KaTeX - Quill Editor
176- const KATEX_FONT_TASK = [
177- {
178- name : 'katex' ,
179- path : 'node_modules/katex/dist/fonts/*'
180- }
181- ] . reduce ( function ( tasks , font ) {
182- const functionName = `buildFonts${ font . name . replace ( / ^ ./ , m => m . toUpperCase ( ) ) } Task` ;
183- const taskFunction = function ( ) {
184- return src ( font . path ) . pipe ( dest ( path . join ( conf . distPath , 'vendor/libs/quill/fonts' ) ) ) ;
185- } ;
186-
187- Object . defineProperty ( taskFunction , 'name' , {
188- value : functionName
163+ iconify . stdout . on ( 'data' , data => {
164+ console . log ( data . toString ( ) ) ;
189165 } ) ;
190166
191- return tasks . concat ( [ taskFunction ] ) ;
192- } , [ ] ) ;
167+ iconify . stderr . on ( 'data' , data => {
168+ console . error ( data . toString ( ) ) ;
169+ } ) ;
193170
194- const buildFontsTask = parallel ( FONT_TASKS , KATEX_FONT_TASK ) ;
171+ iconify . on ( 'close' , code => {
172+ cb ( ) ;
173+ } ) ;
174+ } ;
195175
196176// Clean build directory
197177// -------------------------------------------------------------------------------
@@ -222,7 +202,7 @@ const watchTask = function () {
222202// -------------------------------------------------------------------------------
223203const buildJsTask = series ( webpackJsTask , pageJsTask ) ;
224204
225- const buildTasks = [ buildCssTask , buildJsTask , buildFontsTask ] ;
205+ const buildTasks = [ buildCssTask , buildJsTask , buildIconifyTask ] ;
226206const buildTask = conf . cleanDist
227207 ? series ( cleanAllTask , parallel ( buildTasks ) )
228208 : series ( cleanAllTask , cleanSourcemapsTask , parallel ( buildTasks ) ) ;
@@ -234,7 +214,7 @@ module.exports = {
234214 clean : cleanAllTask ,
235215 'build:js' : buildJsTask ,
236216 'build:css' : buildCssTask ,
237- 'build:fonts ' : buildFontsTask ,
217+ 'build:iconify ' : buildIconifyTask ,
238218 build : buildTask ,
239219 watch : watchTask
240220} ;
0 commit comments