diff --git a/CHANGELOG.md b/CHANGELOG.md index 67b8582..c29e9e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,12 +16,11 @@ All released versions are available as [Releases on this repository](https://git ## History -`v0.9.0` **Support JS and CSS file bundling** +`v0.9.0` **Support JS and CSS file bundling** (2021-04-05) Features - [Support JS and CSS file bundling](https://dev.azure.com/techsmarts/TechSmarts/_workitems/edit/334) - Fixes - [Published env variable logic is flipped](https://dev.azure.com/techsmarts/TechSmarts/_workitems/edit/762) diff --git a/package-lock.json b/package-lock.json index d4288a9..2124739 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@tforster/webproducer", - "version": "0.8.0", + "version": "0.9.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index ce9e483..159f30e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tforster/webproducer", - "version": "0.8.0", + "version": "0.9.0", "description": "WebProducer, or simply WP, is a serverless application for publishing content to the web. It equally supports websites and web applications with a lean, streams based, architecture.", "author": "", "license": "MIT", diff --git a/src/index.js b/src/index.js index c652019..bc24580 100644 --- a/src/index.js +++ b/src/index.js @@ -200,25 +200,20 @@ class WebProducer { ]); looseFiles.name = "looseFiles"; - + // We ignored scripts above as they require unique handling here const scriptStreams = Object.keys(this.globs.scripts).map(key => { let scriptStream = srcStreamReadable.src(`${srcRoot}${this.globs.scripts[key]}`).pipe(concat(key)).pipe(terser()).pipe(sourcemaps.write("/")); scriptStream.name = key; return scriptStream; }) - // We ignored scripts above as they require unique handling here - // const scripts = srcStreamReadable.src(`${srcRoot}/**/*.js`).pipe(concat('main.js')).pipe(terser()).pipe(sourcemaps.write("/")); - // scripts.name = "scripts"; // We ignored stylesheets above as they require unique handling here - const stylesheets = srcStreamReadable - .src(`${srcRoot}/**/*.css`) - .pipe(sourcemaps.init()) - .pipe(cleanCSS()) - .pipe(concat("styles.css")) - .pipe(sourcemaps.write("/")); - stylesheets.name = "stylesheets"; + const cssStreams = Object.keys(this.globs.styles).map(key => { + let cssStream = srcStreamReadable.src(`${srcRoot}${this.globs.styles[key]}`).pipe(cleanCSS()).pipe(concat(key)).pipe(sourcemaps.write("/")); + cssStream.name = key; + return cssStream; + }) // We ignored the stream of handlebars theme files as they were generated earlier and require additional unique handling here const pagesStream = htmlStream.pipe(minifyHtml({ collapseWhitespace: true, removeComments: true })); @@ -228,7 +223,7 @@ class WebProducer { await destinationFilesParsed; // Merge all the various input streams into one main stream to be parsed - const streams = [looseFiles, ...scriptStreams, stylesheets, pagesStream, fileStream]; + const streams = [looseFiles, ...scriptStreams, ...cssStreams, pagesStream, fileStream]; // MergedStream is new in 0.5.0 and replaces the previous and more complicated Promise-based code block const mergedStream = new MergeStream(streams);