diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index c02a816..9b0f9de 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -25,6 +25,6 @@ jobs: npm -v node -v npm install - npm run e2e-test + npm run test env: CI: true diff --git a/tasks/build.js b/tasks/build.js index b0a072d..9f1ed4d 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -6,8 +6,7 @@ const preprocess = require('gulp-preprocess'); const rename = require('gulp-rename'); const del = require('del'); const inlineimg = require('gulp-inline-images-no-http'); -const path = require('path'); -const { getConfigsForDir, getFilePathsForDir } = require('./util/util'); +const { getConfigsForDir, getFilePathsForDir, getCssLinkTagsFromFilelist } = require('./util/util'); function buildTask(options) { // Requires: 'dupe', 'less', 'sass', 'postcss', 'lint'. @@ -29,12 +28,7 @@ function buildTask(options) { */ const files = await getFilePathsForDir(cwd); const context = Object.assign(conf, { - stylesheets: files - .filter(file => !!file.match(/.*\.css/)) // Read only CSS files. - .reduce((acc, cur) => { - const cssPath = path.win32.basename(cur); - return (acc += ''); - }, '') + stylesheets: getCssLinkTagsFromFilelist(files) }); return options diff --git a/tasks/util/util.js b/tasks/util/util.js index 67fda95..3a5393e 100644 --- a/tasks/util/util.js +++ b/tasks/util/util.js @@ -91,6 +91,20 @@ const getHtmlTemplatesFromFilelist = filelist => { ); }; +/** + * Gets an array of css link tags from a filelist (if css files are in the filelist). + * + * @param { Array } filelist + */ +const getCssLinkTagsFromFilelist = filelist => { + return filelist + .filter(file => !!file.match(/.*\.css/)) // Read only CSS files. + .reduce((acc, cur) => { + const cssPath = path.win32.basename(cur); + return (acc += ''); + }, ''); +}; + const log = { warn: (...messages) => { console.warn('🔵 ', chalk.yellow(messages)); @@ -109,7 +123,8 @@ const self = { log, getConfigsForDir, getFilePathsForDir, - getHtmlTemplatesFromFilelist + getHtmlTemplatesFromFilelist, + getCssLinkTagsFromFilelist }; module.exports = self;