@@ -112,7 +112,7 @@ var svgmin = require('gulp-svgmin')
112112 */
113113
114114// Remove pre-existing content from output folders
115- var cleanDist = function ( done ) {
115+ var cleanDist = function ( done ) {
116116 // Make sure this feature is activated before running
117117 if ( ! settings . clean ) return done ( )
118118
@@ -143,13 +143,13 @@ var jsTasks = lazypipe()
143143 . pipe ( dest , paths . scripts . output )
144144
145145// Lint, minify, and concatenate scripts
146- var buildScripts = function ( done ) {
146+ var buildScripts = function ( done ) {
147147 // Make sure this feature is activated before running
148148 if ( ! settings . scripts ) return done ( )
149149
150150 // Run tasks on script files
151151 src ( paths . scripts . input )
152- . pipe ( flatmap ( function ( stream , file ) {
152+ . pipe ( flatmap ( function ( stream , file ) {
153153 // If the file is a directory
154154 if ( file . isDirectory ( ) ) {
155155 // Setup a suffix variable
@@ -184,7 +184,7 @@ var buildScripts = function(done) {
184184}
185185
186186// Lint scripts
187- var lintScripts = function ( done ) {
187+ var lintScripts = function ( done ) {
188188 // Make sure this feature is activated before running
189189 if ( ! settings . scripts ) return done ( )
190190
@@ -201,24 +201,24 @@ var lintScripts = function(done) {
201201
202202// pretty print all xml listings
203203// articles not yet decided
204- var prettyXml = function ( done ) {
204+ var prettyXml = function ( done ) {
205205 src ( paths . xml . listings , { base : "./" } )
206- . pipe ( muxml ( {
207- stripComments : false ,
208- stripCdata : false ,
209- stripInstruction : false ,
210- saxOptions : {
211- trim : true ,
212- normalize : true
213- }
214- } ) )
206+ . pipe ( muxml ( {
207+ stripComments : false ,
208+ stripCdata : false ,
209+ stripInstruction : false ,
210+ saxOptions : {
211+ trim : true ,
212+ normalize : true
213+ }
214+ } ) )
215215 . pipe ( dest ( "./" ) )
216- // Signal completion
217- done ( )
216+ // Signal completion
217+ done ( )
218218}
219219
220220// Process, lint, and minify Sass files
221- var buildStyles = function ( done ) {
221+ var buildStyles = function ( done ) {
222222 // Make sure this feature is activated before running
223223 if ( ! settings . styles ) return done ( )
224224
@@ -258,7 +258,7 @@ var buildStyles = function(done) {
258258}
259259
260260// Optimize SVG files
261- var buildSVGs = function ( done ) {
261+ var buildSVGs = function ( done ) {
262262 // Make sure this feature is activated before running
263263 if ( ! settings . svgs ) return done ( )
264264
@@ -272,7 +272,7 @@ var buildSVGs = function(done) {
272272}
273273
274274// Copy third-party dependencies from node_modules into resources
275- var vendorFiles = function ( done ) {
275+ var vendorFiles = function ( done ) {
276276 // Make sure this feature is activated before running
277277 if ( ! settings . vendor ) return done ( )
278278
@@ -282,11 +282,16 @@ var vendorFiles = function(done) {
282282
283283
284284 // copy vendor scripts
285- src ( [ 'node_modules/bootstrap/dist/js/bootstrap.min.*' , 'node_modules/@popperjs/core/dist/umd/popper.min.*' ] )
285+ src ( [ 'node_modules/bootstrap/dist/js/bootstrap.min.*' , 'node_modules/@popperjs/core/dist/umd/popper.min.*' , 'node_modules/@highlightjs/cdn-assets/highlight.min.js' , 'node_modules/@highlightjs/cdn-assets/languages/xquery.min.js' , 'node_modules/@highlightjs/cdn-assets/languages/dockerfile.min.js' ] )
286+ . pipe ( dest ( paths . scripts . output ) )
287+
288+ // copy pre-packed lang definitions for code highlighter
289+ // CSS Bash Makefile Diff JSON Markdown Perl SQL Shell Properties Less SCSS Puppet'
290+ src ( [ 'node_modules/@highlightjs/cdn-assets/languages/xquery.min.js' , 'node_modules/@highlightjs/cdn-assets/languages/dockerfile.min.js' , 'node_modules/@highlightjs/cdn-assets/languages/apache.min.js' , 'node_modules/@highlightjs/cdn-assets/languages/http.min.js' , 'node_modules/@highlightjs/cdn-assets/languages/nginx.min.js' ] )
286291 . pipe ( dest ( paths . scripts . output ) )
287292
288293 // copy vendor Styles
289- src ( [ 'node_modules/bootstrap/dist/css/bootstrap.min.*' , 'node_modules/highlight.js/ styles/atom-one-dark.css' ] )
294+ src ( [ 'node_modules/bootstrap/dist/css/bootstrap.min.*' , 'node_modules/@highlightjs/cdn-assets/ styles/atom-one-dark.min .css' ] )
290295 . pipe ( dest ( paths . styles . output ) )
291296
292297 // copy vendor fonts
@@ -298,7 +303,7 @@ var vendorFiles = function(done) {
298303
299304
300305// Copy static files into output folder
301- var copyFiles = function ( done ) {
306+ var copyFiles = function ( done ) {
302307 // Make sure this feature is activated before running
303308 if ( ! settings . copy ) return done ( )
304309
@@ -310,32 +315,6 @@ var copyFiles = function(done) {
310315 done ( )
311316}
312317
313- // Build and copy highlight.js
314- var buildPack = function ( done ) {
315- // Make sure this feature is activated before running
316- if ( ! settings . hjs ) return done ( )
317-
318- // build highlight pack
319- // see https://highlightjs.readthedocs.io/en/latest/building-testing.html
320- // TODO currently building is bugged when using npm
321- let command = 'cd node_modules/highlight.js'
322- + ' && npm install'
323- + ' && node tools/build Apache CSS HTTP JavaScript Bash Makefile PHP Diff JSON Markdown Perl SQL HTML Java Nginx Shell Properties Less SCSS Puppet Dockerfile xquery'
324-
325- exec ( command , ( err , stdout , stderr ) => {
326- console . log ( stderr )
327- console . log ( stdout )
328-
329- callback ( err )
330- } )
331-
332- src ( 'node_modules/highlight.js/build/*pack.js' )
333- . pipe ( dest ( paths . scripts . output ) )
334-
335- // Signal completion
336- done ( )
337- }
338-
339318/**
340319 * Export Tasks
341320 */
@@ -351,7 +330,6 @@ exports.default = series(
351330 buildStyles ,
352331 buildSVGs ,
353332 copyFiles ,
354- buildPack ,
355333 prettyXml
356334 )
357335)
0 commit comments