From ac8ce74bfe85e909faf13cf576eac102fadd2a87 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Wed, 5 Dec 2018 16:32:53 +0200 Subject: [PATCH 01/28] Ignored dist folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8555768e..5a7582df 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,4 @@ artifacts* node_modules bower_components +dist From dae4f6ee5e274d7d4dc3848e4a8e8158ce9805f6 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Wed, 5 Dec 2018 16:33:05 +0200 Subject: [PATCH 02/28] Fixed typo --- assets/js/{filtres.js => filters.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename assets/js/{filtres.js => filters.js} (100%) diff --git a/assets/js/filtres.js b/assets/js/filters.js similarity index 100% rename from assets/js/filtres.js rename to assets/js/filters.js From d2bab176bbbfc683aa1e83590218cb8874ddecfd Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Wed, 5 Dec 2018 16:33:15 +0200 Subject: [PATCH 03/28] Added webpack --- package.json | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 36db2046..b4e09cfd 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,16 @@ "theme", "electronics" ], - "dependencies": {}, + "dependencies": { + "ideal-image-slider": "^1.5.0", + "webpack-modernizr-loader": "^4.0.1" + }, "devDependencies": { "autoprefixer": "^7.1.2", "babel-eslint": "^7.2.3", "bower": "~1.8.0", "bower-main": "^0.2.14", + "clean-webpack-plugin": "^1.0.0", "cssnano": "^3.10.0", "del": "^3.0.0", "eslint": "^4.1.1", @@ -56,7 +60,9 @@ "merge2": "^1.2.3", "node-bourbon": "^4.2.8", "node-sass": "^4.5.3", - "run-sequence": "2.1.0" + "run-sequence": "2.1.0", + "webpack": "^4.27.0", + "webpack-cli": "^3.1.2" }, "engineStrict": true, "engines": { @@ -70,5 +76,9 @@ "bugs": { "url": "https://github.com/VirtoCommerce/vc-theme-default/issues" }, - "scripts": {} + "scripts": { + "webpack:dev": "webpack --display-error-details --mode=development", + "webpack:build": "webpack --mode=production", + "webpack:watch": " webpack watch --mode=development" + } } From 5cad1806ea22048f3d59a020a3eba59308735961 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Wed, 5 Dec 2018 16:33:28 +0200 Subject: [PATCH 04/28] Added webpack config --- webpack.config.js | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 webpack.config.js diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..45d93229 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,74 @@ +const path = require('path'); +const CleanWebpackPlugin = require('clean-webpack-plugin'); +const glob = require('glob'); + +const rootPath = path.resolve(__dirname, 'dist'); + +module.exports = [ + { + entry: ['./src/js/checkout-scripts.js', ...glob.sync('./assets/js/common-components/*.js'), ...glob.sync('./assets/js/checkout/*.js')], + output: { + path: rootPath, + filename: 'checkout-scripts.js', + publicPath: '/dist/' + }, + plugins: [ + new CleanWebpackPlugin(rootPath, { verbose: true }) + ], + resolve: { + alias: { + Assets: path.resolve(__dirname, 'assets') + } + } + }, + { + entry: ['./src/js/scripts.js', ...glob.sync('./assets/js/*.js'), ...glob.sync('./assets/js/products-compare/*.js')], + output: { + path: rootPath, + filename: 'scripts.js', + publicPath: '/dist/' + }, + module: { + rules: [ + { + test: /\.modernizrrc\.js$/, + loader: 'webpack-modernizr-loader' + }, + ] + }, + resolve: { + alias: { + Assets: path.resolve(__dirname, 'assets'), + modernizr$: path.resolve(__dirname, ".modernizrrc.js") + } + } + }, + { + entry: [ + './src/js/account-scripts.js', + ...glob.sync('./assets/js/products-compare/*.js'), + ...glob.sync('./assets/js/common-components/*.js'), + ...glob.sync('./assets/js/account/*.js'), + ...glob.sync('./assets/js/lists/*.js') + ], + output: { + path: rootPath, + filename: 'account-scripts.js', + publicPath: '/dist/' + }, + module: { + rules: [ + { + test: /\.modernizrrc\.js$/, + loader: 'webpack-modernizr-loader' + }, + ] + }, + resolve: { + alias: { + Assets: path.resolve(__dirname, 'assets'), + modernizr$: path.resolve(__dirname, ".modernizrrc.js") + } + } + } +] \ No newline at end of file From 4d69fb8824f4b449f715a88558dabb2fde166980 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Wed, 5 Dec 2018 16:33:46 +0200 Subject: [PATCH 05/28] Added modernizrrc file --- .modernizrrc.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .modernizrrc.js diff --git a/.modernizrrc.js b/.modernizrrc.js new file mode 100644 index 00000000..e0d0906e --- /dev/null +++ b/.modernizrrc.js @@ -0,0 +1,12 @@ +"use strict"; + +module.exports = { + options: [ + "setClasses" + ], + "feature-detects": [ + "test/css/flexbox", + "test/es6/promises", + "test/serviceworker" + ] +}; From 917ea49add0e0187147a62638e5f5ba6e17e3487 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Wed, 5 Dec 2018 16:33:55 +0200 Subject: [PATCH 06/28] Entrypoints --- src/js/account-scripts.js | 7 +++++++ src/js/checkout-scripts.js | 5 +++++ src/js/scripts.js | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 src/js/account-scripts.js create mode 100644 src/js/checkout-scripts.js create mode 100644 src/js/scripts.js diff --git a/src/js/account-scripts.js b/src/js/account-scripts.js new file mode 100644 index 00000000..71b4bd5d --- /dev/null +++ b/src/js/account-scripts.js @@ -0,0 +1,7 @@ +import 'modernizr'; +import 'Assets/js/app.js'; +import 'Assets/js/services.js'; +import 'Assets/js/main.js'; +import 'Assets/js/cart.js'; +import 'Assets/js/quote-request.js'; +import 'Assets/js/searchBar.js'; \ No newline at end of file diff --git a/src/js/checkout-scripts.js b/src/js/checkout-scripts.js new file mode 100644 index 00000000..c5510628 --- /dev/null +++ b/src/js/checkout-scripts.js @@ -0,0 +1,5 @@ +import 'Assets/js/app.js'; +import 'Assets/js/services.js'; +import 'Assets/js/directives.js'; +import 'Assets/js/filters.js'; +import 'Assets/js/main.js'; \ No newline at end of file diff --git a/src/js/scripts.js b/src/js/scripts.js new file mode 100644 index 00000000..815482d3 --- /dev/null +++ b/src/js/scripts.js @@ -0,0 +1,6 @@ +import 'modernizr'; +import 'Assets/interactor.js'; +import 'ideal-image-slider/ideal-image-slider'; +import 'ideal-image-slider/extensions/bullet-nav/iis-bullet-nav'; +import 'ideal-image-slider/extensions/captions/iis-captions'; +import 'Assets/js/lists/add-to-list.js' \ No newline at end of file From 06e7cd4913dc8d9c2fdc28bf4b2a67729d7328d4 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 13:05:23 +0200 Subject: [PATCH 07/28] Added JS dependencies --- package.json | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b4e09cfd..3b516425 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,19 @@ "electronics" ], "dependencies": { + "@angular/router": "^0.2.0", + "angular": "^1.5.7", + "angular-credit-cards": "^3.0.1", + "angular-filter": "^0.5.8", + "angular-resource": "^1.5.7", + "angular-sanitize": "^1.5.7", + "angular-translate": "^2.12.1", + "angular-translate-loader-url": "^2.12.1", + "angular-ui-bootstrap": "^2.5.6", "ideal-image-slider": "^1.5.0", + "jquery": "^1.11.0", + "ngstorage": "^0.3.11", + "underscore": "^1.8.3", "webpack-modernizr-loader": "^4.0.1" }, "devDependencies": { @@ -36,6 +48,7 @@ "eslint-plugin-node": "^5.1.0", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^3.0.1", + "exports-loader": "^0.7.0", "gulp": "^3.9.1", "gulp-clean": "^0.3.2", "gulp-concat": "^2.6.1", @@ -79,6 +92,6 @@ "scripts": { "webpack:dev": "webpack --display-error-details --mode=development", "webpack:build": "webpack --mode=production", - "webpack:watch": " webpack watch --mode=development" + "webpack:watch": " webpack --watch --mode=development" } } From dd6ce4bcb0f5248737eeab512575a3d893241ebf Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 13:05:42 +0200 Subject: [PATCH 08/28] Changed webpack config --- webpack.config.js | 68 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 45d93229..7945cfca 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,8 +1,9 @@ const path = require('path'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const glob = require('glob'); +const webpack = require('webpack'); -const rootPath = path.resolve(__dirname, 'dist'); +const rootPath = path.resolve(__dirname, 'assets/dist'); module.exports = [ { @@ -10,10 +11,18 @@ module.exports = [ output: { path: rootPath, filename: 'checkout-scripts.js', - publicPath: '/dist/' + publicPath: 'assets/dist/' }, plugins: [ - new CleanWebpackPlugin(rootPath, { verbose: true }) + new CleanWebpackPlugin(rootPath, { verbose: true }), + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + 'window.jQuery': 'jquery' + }), + new webpack.ProvidePlugin({ + _: 'underscore' + }) ], resolve: { alias: { @@ -22,18 +31,23 @@ module.exports = [ } }, { - entry: ['./src/js/scripts.js', ...glob.sync('./assets/js/*.js'), ...glob.sync('./assets/js/products-compare/*.js')], + entry: [...glob.sync('./assets/js/*.js'), './src/js/scripts.js', ...glob.sync('./assets/js/products-compare/*.js')], output: { path: rootPath, filename: 'scripts.js', - publicPath: '/dist/' + publicPath: 'assets/dist/' }, + devtool: 'eval-source-map', module: { rules: [ { test: /\.modernizrrc\.js$/, loader: 'webpack-modernizr-loader' }, + { + test: require.resolve('ideal-image-slider/ideal-image-slider'), + use: 'exports-loader?IdealImageSlider' + } ] }, resolve: { @@ -41,7 +55,20 @@ module.exports = [ Assets: path.resolve(__dirname, 'assets'), modernizr$: path.resolve(__dirname, ".modernizrrc.js") } - } + }, + plugins: [ + new webpack.ProvidePlugin({ + IdealImageSlider: 'ideal-image-slider/ideal-image-slider.js' + }), + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + 'window.jQuery': 'jquery' + }), + new webpack.ProvidePlugin({ + _: 'underscore' + }) + ] }, { entry: [ @@ -54,7 +81,7 @@ module.exports = [ output: { path: rootPath, filename: 'account-scripts.js', - publicPath: '/dist/' + publicPath: 'assets/dist/' }, module: { rules: [ @@ -69,6 +96,31 @@ module.exports = [ Assets: path.resolve(__dirname, 'assets'), modernizr$: path.resolve(__dirname, ".modernizrrc.js") } - } + }, + plugins: [ + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + 'window.jQuery': 'jquery' + }), + new webpack.ProvidePlugin({ + _: 'underscore' + }) + ] + }, + { + entry: './src/js/vendor.js', + output: { + path: rootPath, + filename: 'scripts_dependencies.js', + publicPath: 'assets/dist/' + }, + plugins: [ + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + 'window.jQuery': 'jquery' + }) + ] } ] \ No newline at end of file From 070bc6e19db9b6976fe6c3c7a7d17a349eb40a72 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 13:05:56 +0200 Subject: [PATCH 09/28] Added vendors dependencies file --- src/js/vendor.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/js/vendor.js diff --git a/src/js/vendor.js b/src/js/vendor.js new file mode 100644 index 00000000..f34e49a7 --- /dev/null +++ b/src/js/vendor.js @@ -0,0 +1,12 @@ +import * as $ from 'jquery'; +window.$ = $; +import 'angular'; +import 'ngstorage'; +import 'angular-sanitize'; +import 'angular-translate'; +import 'angular-translate-loader-url'; +import 'angular-ui-bootstrap'; +import 'angular-credit-cards'; +import 'angular-resource'; +import '@angular/router/angular1/angular_1_router'; +import 'angular-filter'; From 300ab78d682bf913bcb033da9ca6365bcb503c4c Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 13:06:43 +0200 Subject: [PATCH 10/28] Added semicolon --- src/js/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/scripts.js b/src/js/scripts.js index 815482d3..c8b33a55 100644 --- a/src/js/scripts.js +++ b/src/js/scripts.js @@ -3,4 +3,4 @@ import 'Assets/interactor.js'; import 'ideal-image-slider/ideal-image-slider'; import 'ideal-image-slider/extensions/bullet-nav/iis-bullet-nav'; import 'ideal-image-slider/extensions/captions/iis-captions'; -import 'Assets/js/lists/add-to-list.js' \ No newline at end of file +import 'Assets/js/lists/add-to-list.js'; \ No newline at end of file From 786adcaef9d73c34d938b9fed2e824113cc5d53c Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 14:59:20 +0200 Subject: [PATCH 11/28] Added legacy libraries --- src/js/scripts.js | 4 +++- webpack.config.js | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/js/scripts.js b/src/js/scripts.js index c8b33a55..bb4cc3f4 100644 --- a/src/js/scripts.js +++ b/src/js/scripts.js @@ -1,6 +1,8 @@ import 'modernizr'; +import 'Assets/js/app.js'; import 'Assets/interactor.js'; -import 'ideal-image-slider/ideal-image-slider'; +import * as IdealImageSlider from'ideal-image-slider/ideal-image-slider'; +window.IdealImageSlider = IdealImageSlider; import 'ideal-image-slider/extensions/bullet-nav/iis-bullet-nav'; import 'ideal-image-slider/extensions/captions/iis-captions'; import 'Assets/js/lists/add-to-list.js'; \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 7945cfca..9abb4013 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -31,7 +31,11 @@ module.exports = [ } }, { - entry: [...glob.sync('./assets/js/*.js'), './src/js/scripts.js', ...glob.sync('./assets/js/products-compare/*.js')], + entry: [ + './src/js/scripts.js', + ...glob.sync('./assets/js/*.js', { ignore: './assets/js/app.js', nosort: true }), + ...glob.sync('./assets/js/products-compare/*.js') + ], output: { path: rootPath, filename: 'scripts.js', @@ -57,15 +61,11 @@ module.exports = [ } }, plugins: [ - new webpack.ProvidePlugin({ - IdealImageSlider: 'ideal-image-slider/ideal-image-slider.js' - }), new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', - 'window.jQuery': 'jquery' - }), - new webpack.ProvidePlugin({ + 'window.jQuery': 'jquery', + IdealImageSlider: 'ideal-image-slider/ideal-image-slider', _: 'underscore' }) ] From 21eec9e8f5cffa89f2325dc397eb7a143dc5a3cb Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 15:20:53 +0200 Subject: [PATCH 12/28] Added webpack bundled scripts to theme --- layout/theme.liquid | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layout/theme.liquid b/layout/theme.liquid index 24410031..f7e22abc 100644 --- a/layout/theme.liquid +++ b/layout/theme.liquid @@ -34,8 +34,10 @@ {% include 'oldIE-js' %} - {{ 'bundle/scripts_dependencies.js' | static_asset_url | append_version | script_tag }} - {{ 'bundle/scripts.js' | static_asset_url | append_version | script_tag }} + {{ 'dist/scripts_dependencies.js' | asset_url | append_version | script_tag }} + {{ 'dist/scripts.js' | asset_url | append_version | script_tag }} + + {{ 'shop.js' | asset_url | script_tag }} {{ 'shopify_common.js' | asset_url | script_tag }} From f30e7d73f2808e0f26271630f1147c8320c7943b Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:38:57 +0200 Subject: [PATCH 13/28] Added some dependencies --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b516425..e47426dd 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "bower": "~1.8.0", "bower-main": "^0.2.14", "clean-webpack-plugin": "^1.0.0", + "css-loader": "^2.0.0", "cssnano": "^3.10.0", "del": "^3.0.0", "eslint": "^4.1.1", @@ -49,6 +50,7 @@ "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^3.0.1", "exports-loader": "^0.7.0", + "file-loader": "^2.0.0", "gulp": "^3.9.1", "gulp-clean": "^0.3.2", "gulp-concat": "^2.6.1", @@ -71,11 +73,13 @@ "main-bower-files": "^2.13.1", "merge-stream": "^1.0.1", "merge2": "^1.2.3", + "mini-css-extract-plugin": "^0.5.0", "node-bourbon": "^4.2.8", "node-sass": "^4.5.3", "run-sequence": "2.1.0", "webpack": "^4.27.0", - "webpack-cli": "^3.1.2" + "webpack-cli": "^3.1.2", + "webpack-fix-style-only-entries": "0.0.5" }, "engineStrict": true, "engines": { From b61b49447f99da0e9fb29b076ad42ddf602eace7 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:39:11 +0200 Subject: [PATCH 14/28] Added config for styles --- webpack.config.js | 50 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 9abb4013..7b8db2d6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,8 @@ const path = require('path'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const glob = require('glob'); const webpack = require('webpack'); +const FixStylesOnlyEntriesPlugin = require('webpack-fix-style-only-entries'); +const MinCssExtractPlugin = require('mini-css-extract-plugin'); const rootPath = path.resolve(__dirname, 'assets/dist'); @@ -18,15 +20,14 @@ module.exports = [ new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', - 'window.jQuery': 'jquery' - }), - new webpack.ProvidePlugin({ + 'window.jQuery': 'jquery', _: 'underscore' }) ], resolve: { alias: { - Assets: path.resolve(__dirname, 'assets') + Assets: path.resolve(__dirname, 'assets'), + Vendor: path.resolve(__dirname, 'node_modules') } } }, @@ -122,5 +123,46 @@ module.exports = [ 'window.jQuery': 'jquery' }) ] + }, + { + entry: { + 'styles': './src/css/styles.css', + 'checkout-styles': './src/css/checkout-styles.css', + 'account-styles': './src/css/account-styles.css' + }, + module: { + rules: [ + { + test: /\.(jpe?g|png|gif|svg)$/i, + loader: "file-loader", + options: { + name: '[name].[ext]', + outputPath: 'images/' + } + }, + { + test: /\.css$/, + use: [ + MinCssExtractPlugin.loader, + 'css-loader' + ] + } + ] + }, + output: { + path: rootPath, + publicPath: 'assets/dist/' + }, + plugins: [ + new FixStylesOnlyEntriesPlugin(), + new MinCssExtractPlugin({ + filename: "[name].css" + }) + ], + resolve: { + alias: { + Assets: path.resolve(__dirname, 'assets') + } + } } ] \ No newline at end of file From 10da868b7f2fea0572f09babd9ec1ceab21711f6 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:39:33 +0200 Subject: [PATCH 15/28] Added styles entrypoints --- src/css/account-styles.css | 2 ++ src/css/checkout-styles.css | 1 + src/css/styles.css | 4 ++++ 3 files changed, 7 insertions(+) create mode 100644 src/css/account-styles.css create mode 100644 src/css/checkout-styles.css create mode 100644 src/css/styles.css diff --git a/src/css/account-styles.css b/src/css/account-styles.css new file mode 100644 index 00000000..1f4724ec --- /dev/null +++ b/src/css/account-styles.css @@ -0,0 +1,2 @@ +@import '~Assets/account-bootstrap.css'; +@import '~Assets/common-components.css'; \ No newline at end of file diff --git a/src/css/checkout-styles.css b/src/css/checkout-styles.css new file mode 100644 index 00000000..8c8a410d --- /dev/null +++ b/src/css/checkout-styles.css @@ -0,0 +1 @@ +@import '~Assets/common-components.css'; \ No newline at end of file diff --git a/src/css/styles.css b/src/css/styles.css new file mode 100644 index 00000000..1a97d3e1 --- /dev/null +++ b/src/css/styles.css @@ -0,0 +1,4 @@ +@import '~Assets/storefront.css'; +@import '~Assets/common-components.css'; +@import '~ideal-image-slider/ideal-image-slider.css'; +@import '~ideal-image-slider/themes/default/default.css'; \ No newline at end of file From f9b18173461e310299f1d28116a429bb0cc6b40e Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:39:42 +0200 Subject: [PATCH 16/28] Removed redundant code --- assets/common-components.css | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/assets/common-components.css b/assets/common-components.css index 29433aa5..88b02637 100644 --- a/assets/common-components.css +++ b/assets/common-components.css @@ -675,16 +675,6 @@ select { background-image: url('sofort.svg'), none; } -.payment-icon--solo { - background-image: url('solo.svg'); - background-image: url('solo.svg'), none; -} - -.payment-icon--switch { - background-image: url('switch.svg'); - background-image: url('switch.svg'), none; -} - .payment-icon--unionpay { background-image: url('unionpay.svg'); background-image: url('unionpay.svg'), none; From bb01fdf884c0993bccde7d6e02b81d7d44e07c80 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:56:12 +0200 Subject: [PATCH 17/28] Fixed typo --- src/js/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/scripts.js b/src/js/scripts.js index bb4cc3f4..b6a0d42a 100644 --- a/src/js/scripts.js +++ b/src/js/scripts.js @@ -1,7 +1,7 @@ import 'modernizr'; import 'Assets/js/app.js'; import 'Assets/interactor.js'; -import * as IdealImageSlider from'ideal-image-slider/ideal-image-slider'; +import * as IdealImageSlider from 'ideal-image-slider/ideal-image-slider'; window.IdealImageSlider = IdealImageSlider; import 'ideal-image-slider/extensions/bullet-nav/iis-bullet-nav'; import 'ideal-image-slider/extensions/captions/iis-captions'; From 9c18a4537dc1c396994b0b2339235da55a389daa Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:56:58 +0200 Subject: [PATCH 18/28] Union configs to single --- webpack.config.js | 147 +++++++++++----------------------------------- 1 file changed, 34 insertions(+), 113 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 7b8db2d6..9a7cbe4a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,40 +9,34 @@ const rootPath = path.resolve(__dirname, 'assets/dist'); module.exports = [ { - entry: ['./src/js/checkout-scripts.js', ...glob.sync('./assets/js/common-components/*.js'), ...glob.sync('./assets/js/checkout/*.js')], - output: { - path: rootPath, - filename: 'checkout-scripts.js', - publicPath: 'assets/dist/' + entry: { + 'checkout-scripts': [ + './src/js/checkout-scripts.js', + ...glob.sync('./assets/js/common-components/*.js'), + ...glob.sync('./assets/js/checkout/*.js') + ], + 'scripts': [ + './src/js/scripts.js', + ...glob.sync('./assets/js/*.js', { ignore: './assets/js/app.js', nosort: true }), + ...glob.sync('./assets/js/products-compare/*.js') + ], + 'account-scripts': [ + './src/js/account-scripts.js', + ...glob.sync('./assets/js/products-compare/*.js'), + ...glob.sync('./assets/js/common-components/*.js'), + ...glob.sync('./assets/js/account/*.js'), + ...glob.sync('./assets/js/lists/*.js') + ], + 'scripts_dependencies': './src/js/vendor.js', + 'styles': './src/css/styles.css', + 'checkout-styles': './src/css/checkout-styles.css', + 'account-styles': './src/css/account-styles.css' }, - plugins: [ - new CleanWebpackPlugin(rootPath, { verbose: true }), - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - 'window.jQuery': 'jquery', - _: 'underscore' - }) - ], - resolve: { - alias: { - Assets: path.resolve(__dirname, 'assets'), - Vendor: path.resolve(__dirname, 'node_modules') - } - } - }, - { - entry: [ - './src/js/scripts.js', - ...glob.sync('./assets/js/*.js', { ignore: './assets/js/app.js', nosort: true }), - ...glob.sync('./assets/js/products-compare/*.js') - ], output: { path: rootPath, - filename: 'scripts.js', + filename: '[name].js', publicPath: 'assets/dist/' }, - devtool: 'eval-source-map', module: { rules: [ { @@ -52,86 +46,7 @@ module.exports = [ { test: require.resolve('ideal-image-slider/ideal-image-slider'), use: 'exports-loader?IdealImageSlider' - } - ] - }, - resolve: { - alias: { - Assets: path.resolve(__dirname, 'assets'), - modernizr$: path.resolve(__dirname, ".modernizrrc.js") - } - }, - plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - 'window.jQuery': 'jquery', - IdealImageSlider: 'ideal-image-slider/ideal-image-slider', - _: 'underscore' - }) - ] - }, - { - entry: [ - './src/js/account-scripts.js', - ...glob.sync('./assets/js/products-compare/*.js'), - ...glob.sync('./assets/js/common-components/*.js'), - ...glob.sync('./assets/js/account/*.js'), - ...glob.sync('./assets/js/lists/*.js') - ], - output: { - path: rootPath, - filename: 'account-scripts.js', - publicPath: 'assets/dist/' - }, - module: { - rules: [ - { - test: /\.modernizrrc\.js$/, - loader: 'webpack-modernizr-loader' }, - ] - }, - resolve: { - alias: { - Assets: path.resolve(__dirname, 'assets'), - modernizr$: path.resolve(__dirname, ".modernizrrc.js") - } - }, - plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - 'window.jQuery': 'jquery' - }), - new webpack.ProvidePlugin({ - _: 'underscore' - }) - ] - }, - { - entry: './src/js/vendor.js', - output: { - path: rootPath, - filename: 'scripts_dependencies.js', - publicPath: 'assets/dist/' - }, - plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - 'window.jQuery': 'jquery' - }) - ] - }, - { - entry: { - 'styles': './src/css/styles.css', - 'checkout-styles': './src/css/checkout-styles.css', - 'account-styles': './src/css/account-styles.css' - }, - module: { - rules: [ { test: /\.(jpe?g|png|gif|svg)$/i, loader: "file-loader", @@ -149,11 +64,15 @@ module.exports = [ } ] }, - output: { - path: rootPath, - publicPath: 'assets/dist/' - }, plugins: [ + new CleanWebpackPlugin(rootPath, { verbose: true }), + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + 'window.jQuery': 'jquery', + _: 'underscore', + IdealImageSlider: 'ideal-image-slider/ideal-image-slider', + }), new FixStylesOnlyEntriesPlugin(), new MinCssExtractPlugin({ filename: "[name].css" @@ -161,7 +80,9 @@ module.exports = [ ], resolve: { alias: { - Assets: path.resolve(__dirname, 'assets') + Assets: path.resolve(__dirname, 'assets'), + Vendor: path.resolve(__dirname, 'node_modules'), + modernizr$: path.resolve(__dirname, ".modernizrrc.js") } } } From 9004ab683d1138e883dc3045c6aa46d362717a25 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Fri, 7 Dec 2018 17:59:13 +0200 Subject: [PATCH 19/28] Fixed typo --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e47426dd..40152a29 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,6 @@ "scripts": { "webpack:dev": "webpack --display-error-details --mode=development", "webpack:build": "webpack --mode=production", - "webpack:watch": " webpack --watch --mode=development" + "webpack:watch": "webpack --watch --mode=development" } } From 757ea18e5ea294f4253adc52a7074eda114ec4d3 Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Mon, 10 Dec 2018 13:19:55 +0200 Subject: [PATCH 20/28] Added modules dependency list to a json file and defined as global webpack variable --- assets/js/app.js | 6 ------ assets/js/storefrontAppDependencies.json | 8 ++++++++ webpack.config.js | 5 +++++ 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 assets/js/storefrontAppDependencies.json diff --git a/assets/js/app.js b/assets/js/app.js index 04f86701..806b92ec 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -1,9 +1,3 @@ -var storefrontAppDependencies = [ - 'ui.bootstrap', - 'ngStorage', - 'pascalprecht.translate', - 'ngSanitize', -] var storefrontApp = angular.module('storefrontApp', storefrontAppDependencies); storefrontApp.factory('httpErrorInterceptor', ['$q', '$rootScope', function ($q, $rootScope) { diff --git a/assets/js/storefrontAppDependencies.json b/assets/js/storefrontAppDependencies.json new file mode 100644 index 00000000..800cf498 --- /dev/null +++ b/assets/js/storefrontAppDependencies.json @@ -0,0 +1,8 @@ +{ + "storefrontAppDependencies": [ + "ui.bootstrap", + "ngStorage", + "pascalprecht.translate", + "ngSanitize" + ] +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 9a7cbe4a..37893755 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,6 +7,8 @@ const MinCssExtractPlugin = require('mini-css-extract-plugin'); const rootPath = path.resolve(__dirname, 'assets/dist'); +const storefrontAppDependencies = require('./assets/js/storefrontAppDependencies').storefrontAppDependencies; + module.exports = [ { entry: { @@ -76,6 +78,9 @@ module.exports = [ new FixStylesOnlyEntriesPlugin(), new MinCssExtractPlugin({ filename: "[name].css" + }), + new webpack.DefinePlugin({ + storefrontAppDependencies: JSON.stringify(storefrontAppDependencies) }) ], resolve: { From f29064e51033b1ebe7fb0480bd598250779e300f Mon Sep 17 00:00:00 2001 From: Dmitry Pushnitsa Date: Mon, 10 Dec 2018 13:20:28 +0200 Subject: [PATCH 21/28] Changed bundle to dist files --- layout/account_layout.liquid | 10 ++++++---- layout/checkout_layout.liquid | 8 ++++---- layout/theme.liquid | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/layout/account_layout.liquid b/layout/account_layout.liquid index f6ee3263..28f92a8c 100644 --- a/layout/account_layout.liquid +++ b/layout/account_layout.liquid @@ -23,7 +23,7 @@ {{ '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css' | stylesheet_tag }} - {{ 'bundle/account-styles.css' | static_asset_url | append_version | stylesheet_tag }} + {{ 'dist/account-styles.css' | asset_url | append_version | stylesheet_tag }} {{ 'ajaxify.scss.css' | asset_url | stylesheet_tag }} {{ 'default.scss.css' | asset_url | stylesheet_tag }} @@ -32,9 +32,11 @@ - {{ 'bundle/scripts_dependencies.js' | static_asset_url | append_version | script_tag }} - {{ 'bundle/scripts.js' | static_asset_url | append_version | script_tag }} - {{ 'bundle/account-scripts.js' | static_asset_url | append_version | script_tag }} + {{ 'dist/scripts_dependencies.js' | asset_url | append_version | script_tag }} + {{ 'dist/scripts.js' | asset_url | append_version | script_tag }} + {{ 'dist/account-scripts.js' | asset_url | append_version | script_tag }} + + {{ 'shop.js' | asset_url | script_tag }} diff --git a/layout/checkout_layout.liquid b/layout/checkout_layout.liquid index b80c1c26..adee5f2d 100644 --- a/layout/checkout_layout.liquid +++ b/layout/checkout_layout.liquid @@ -10,13 +10,13 @@ {{ '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css' | stylesheet_tag }} {{ 'checkout.css' | asset_url | stylesheet_tag }} - {{ 'bundle/checkout-styles.css' | static_asset_url | append_version | stylesheet_tag }} + {{ 'dist/checkout-styles.css' | asset_url | append_version | stylesheet_tag }} - {{ 'bundle/scripts_dependencies.js' | static_asset_url | append_version | script_tag }} - {{ 'bundle/scripts.js' | static_asset_url | append_version | script_tag }} - {{ 'bundle/checkout-scripts.js' | static_asset_url | append_version | script_tag }} + {{ 'dist/scripts_dependencies.js' | asset_url | append_version | script_tag }} + {{ 'dist/scripts.js' | asset_url | append_version | script_tag }} + {{ 'dist/checkout-scripts.js' | asset_url | append_version | script_tag }} {{ content_for_header }} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 6582dfc8..4c85d25b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,8 +7,6 @@ const MinCssExtractPlugin = require('mini-css-extract-plugin'); const rootPath = path.resolve(__dirname, 'assets/dist'); -const storefrontAppDependencies = require('./assets/js/storefrontAppDependencies').storefrontAppDependencies; - module.exports = [ { entry: { @@ -73,14 +71,11 @@ module.exports = [ jQuery: 'jquery', 'window.jQuery': 'jquery', _: 'underscore', - IdealImageSlider: 'ideal-image-slider/ideal-image-slider', + IdealImageSlider: 'ideal-image-slider/ideal-image-slider' }), new FixStylesOnlyEntriesPlugin(), new MinCssExtractPlugin({ filename: "[name].css" - }), - new webpack.DefinePlugin({ - storefrontAppDependencies: JSON.stringify(storefrontAppDependencies) }) ], resolve: {