From 41ad3b4eb5d1a76d27ec79b8500d7d52710853e9 Mon Sep 17 00:00:00 2001 From: David Hellmann Date: Thu, 19 Dec 2019 15:15:03 +0100 Subject: [PATCH 1/7] Fix path for importScripts --- webpack.settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.settings.js b/webpack.settings.js index 4a59447..7e7cc0a 100644 --- a/webpack.settings.js +++ b/webpack.settings.js @@ -110,7 +110,7 @@ module.exports = { swDest: "../sw.js", precacheManifestFilename: "js/precache-manifest.[manifestHash].js", importScripts: [ - "/dist/workbox-catch-handler.js" + "/dist/js/workbox-catch-handler.js" ], exclude: [ /\.(png|jpe?g|gif|svg|webp)$/i, From 2ab191e4833a807f0229d8e8644432162b3a37b4 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 5 Feb 2020 13:09:24 -0500 Subject: [PATCH 2/7] Added `settings.babelLoaderConfig.include` --- webpack.common.js | 1 + webpack.settings.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/webpack.common.js b/webpack.common.js index 592f1fc..7dadd8e 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -21,6 +21,7 @@ const configureBabelLoader = (browserList) => { return { test: /\.js$/, exclude: settings.babelLoaderConfig.exclude, + include: settings.babelLoaderConfig.include, use: { loader: 'babel-loader', options: { diff --git a/webpack.settings.js b/webpack.settings.js index 7e7cc0a..e01fe3c 100644 --- a/webpack.settings.js +++ b/webpack.settings.js @@ -38,6 +38,8 @@ module.exports = { exclude: [ /(node_modules|bower_components)/ ], + include: [ + ], }, copyWebpackConfig: [ { From db9df26fd594ee703a69f627634e1c05e4036152 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 5 Feb 2020 13:11:47 -0500 Subject: [PATCH 3/7] Removed entirely the concept of a "modern" and "legacy" build from the `webpack.dev.js`; we don't need legacy builds with `webpack-dev-server` --- webpack.dev.js | 170 ++++++++++++++++++------------------------------- 1 file changed, 61 insertions(+), 109 deletions(-) diff --git a/webpack.dev.js b/webpack.dev.js index 0e1b4a0..8b7033b 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -1,6 +1,4 @@ // webpack.dev.js - developmental builds -const LEGACY_CONFIG = 'legacy'; -const MODERN_CONFIG = 'modern'; // node modules const merge = require('webpack-merge'); @@ -16,7 +14,7 @@ const pkg = require('./package.json'); const settings = require('./webpack.settings.js'); // Configure the webpack-dev-server -const configureDevServer = (buildType) => { +const configureDevServer = () => { return { public: settings.devServerConfig.public(), contentBase: path.resolve(__dirname, settings.paths.templates), @@ -38,118 +36,72 @@ const configureDevServer = (buildType) => { }; // Configure Image loader -const configureImageLoader = (buildType) => { - if (buildType === LEGACY_CONFIG) { - return { - test: /\.(png|jpe?g|gif|svg|webp)$/i, - use: [ - { - loader: 'file-loader', - options: { - name: 'img/[name].[hash].[ext]' - } - } - ] - }; - } - if (buildType === MODERN_CONFIG) { - return { - test: /\.(png|jpe?g|gif|svg|webp)$/i, - use: [ - { - loader: 'file-loader', - options: { - name: 'img/[name].[hash].[ext]' - } +const configureImageLoader = () => { + return { + test: /\.(png|jpe?g|gif|svg|webp)$/i, + use: [ + { + loader: 'file-loader', + options: { + name: 'img/[name].[hash].[ext]' } - ] - }; - } + } + ] + }; }; // Configure the Postcss loader -const configurePostcssLoader = (buildType) => { - // Don't generate CSS for the legacy config in development - if (buildType === LEGACY_CONFIG) { - return { - test: /\.(pcss|css)$/, - loader: 'ignore-loader' - }; - } - if (buildType === MODERN_CONFIG) { - return { - test: /\.(pcss|css)$/, - use: [ - { - loader: 'style-loader', - }, - { - loader: 'vue-style-loader', - }, - { - loader: 'css-loader', - options: { - importLoaders: 2, - sourceMap: true - } - }, - { - loader: 'resolve-url-loader' - }, - { - loader: 'postcss-loader', - options: { - sourceMap: true - } - } - ] - }; - } -}; - -// Development module exports -module.exports = [ - merge( - common.legacyConfig, - { - output: { - filename: path.join('./js', '[name]-legacy.[hash].js'), - publicPath: settings.devServerConfig.public() + '/', +const configurePostcssLoader = () => { + return { + test: /\.(pcss|css)$/, + use: [ + { + loader: 'style-loader', }, - mode: 'development', - devtool: 'inline-source-map', - devServer: configureDevServer(LEGACY_CONFIG), - module: { - rules: [ - configurePostcssLoader(LEGACY_CONFIG), - configureImageLoader(LEGACY_CONFIG), - ], + { + loader: 'vue-style-loader', }, - plugins: [ - new webpack.HotModuleReplacementPlugin(), - ], - } - ), - merge( - common.modernConfig, - { - output: { - filename: path.join('./js', '[name].[hash].js'), - publicPath: settings.devServerConfig.public() + '/', + { + loader: 'css-loader', + options: { + url: false, + importLoaders: 2, + sourceMap: true + } }, - mode: 'development', - devtool: 'inline-source-map', - devServer: configureDevServer(MODERN_CONFIG), - module: { - rules: [ - configurePostcssLoader(MODERN_CONFIG), - configureImageLoader(MODERN_CONFIG), - ], + { + loader: 'resolve-url-loader' }, - plugins: [ - new webpack.HotModuleReplacementPlugin(), - new DashboardPlugin(), + { + loader: 'postcss-loader', + options: { + sourceMap: true + } + } + ] + }; +}; + +// Development module exports +module.exports = merge( + common.modernConfig, + { + output: { + filename: path.join('./js', '[name].[hash].js'), + publicPath: settings.devServerConfig.public() + '/', + }, + mode: 'development', + devtool: 'inline-source-map', + devServer: configureDevServer(), + module: { + rules: [ + configurePostcssLoader(), + configureImageLoader(), ], - } - ), -]; + }, + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new DashboardPlugin(), + ], + } +); From ffaa5847606fdbd2bd7e95393b63292660afaa54 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 5 Feb 2020 13:12:43 -0500 Subject: [PATCH 4/7] Changed deprecated use of `cacheFirst` to `CacheFirst` in the Workbox config --- webpack.settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.settings.js b/webpack.settings.js index e01fe3c..16e4de2 100644 --- a/webpack.settings.js +++ b/webpack.settings.js @@ -136,7 +136,7 @@ module.exports = { }, { urlPattern: /\.(?:png|jpg|jpeg|svg|webp)$/, - handler: "cacheFirst", + handler: "CacheFirst", options: { cacheName: "images", expiration: { From 1edfcb8d66731dbc1f6af2a6731bca57914d8556 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 5 Feb 2020 13:12:55 -0500 Subject: [PATCH 5/7] Version 2.0.4 --- CHANGELOG.md | 18 ++++++++++++++---- composer.json | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b7584..34aa7c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # nystudio107/craft Change Log -## 2.0.3 - 2018.08.29 +## 2.0.4 - 2019.08.29 +### Added +* Added `settings.babelLoaderConfig.include` + +### Changed +* Removed entirely the concept of a "modern" and "legacy" build from the `webpack.dev.js`; we don't need legacy builds with `webpack-dev-server` + +### Fixed +* Changed deprecated use of `cacheFirst` to `CacheFirst` in the Workbox config + +## 2.0.3 - 2019.08.29 ### Added * Added a default `config/project.yaml` for base setup @@ -9,18 +19,18 @@ * Ignore CP and `.php` for Service Worker runtime caching * Remove `siteUrl`, since it is now set via Project Config -## 2.0.2 - 2018.08.17 +## 2.0.2 - 2019.08.17 ### Changed * Added `maxUploadFileSize` to `general.php` * Added `/web/dist/*` to `.gitignore` * Refactored the error pages out to a single channel * Added generic login image background -## 2.0.1 - 2018.08.15 +## 2.0.1 - 2019.08.15 ### Changed * Numerous template changes to get the base build working -## 2.0.0 - 2018.08.14 +## 2.0.0 - 2019.08.14 ### Changed * Updated to use modern webpack config * Updated to use Craft 3.2 as the baseline diff --git a/composer.json b/composer.json index e29d65e..07417da 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "craftcms/craft", "description": "nystudio107 Craft 3.2 CMS scaffolding project", - "version": "2.0.3", + "version": "2.0.4", "keywords": [ "craft", "cms", From ef86ff86e94b67d4164bfbbc913b580ccf5c25c4 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 5 Feb 2020 13:17:05 -0500 Subject: [PATCH 6/7] Added info on the base Twig templating setup --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e9e5238..6a81b18 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This is an alternate scaffolding package for Craft 3 CMS projects to Pixel & Ton The project is based on [Craft CMS](https://CraftCMS.com) using a unique `templates/_boilerplate` system for web/AJAX/AMP pages, and implements a number of technologies/techniques: +* A base Twig templating setup as described in [An Effective Twig Base Templating Setup](https://nystudio107.com/blog/an-effective-twig-base-templating-setup) * [webpack](https://webpack.js.org/) is used for the build system as per [An Annotated webpack 4 Config for Frontend Web Development](https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development) * [VueJS](https://vuejs.org/) is used for some of the interactive bits on the website as per * [Tailwind CSS](https://tailwindcss.com/) for the site-wide CSS From 1fe90f4646725116487c71ed812f98957ba9f87f Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 5 Feb 2020 13:18:17 -0500 Subject: [PATCH 7/7] Version 2.0.4 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34aa7c8..04f00c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # nystudio107/craft Change Log -## 2.0.4 - 2019.08.29 +## 2.0.4 - 2020.02.05 ### Added * Added `settings.babelLoaderConfig.include`