diff --git a/.modernizrrc.js b/.modernizrrc.js deleted file mode 100644 index fc98c2db50..0000000000 --- a/.modernizrrc.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - options: [ 'setClasses' ], - - // here you can find all the available tests: - // https://github.com/Modernizr/Modernizr/blob/master/lib/config-all.json - 'feature-detects': [ - 'touchevents', - 'test/css/flexbox' - ] -}; diff --git a/Dockerfile b/Dockerfile index aae6e8b909..31d7b3a464 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ COPY source source COPY lib lib COPY locales locales COPY data data -COPY .modernizrrc.js . COPY config.rb . COPY Gemfile . COPY Gemfile.lock . diff --git a/config.rb b/config.rb index 45dbb751bf..0823c606a4 100644 --- a/config.rb +++ b/config.rb @@ -45,14 +45,15 @@ def retry_on_error(limit: 5) raise e end -DATO_ENV = ENV.has_key?("DATO_ENV") ? ENV.fetch("DATO_ENV") : nil +# DATO_ENV = ENV.has_key?("DATO_ENV") ? ENV.fetch("DATO_ENV") : nil retry_on_error(limit: 10) do activate :dato, token: ENV.fetch("DATO_API_TOKEN"), live_reload: true, preview: ENV.fetch("BUILD_ENV") != "production", - environment: DATO_ENV + environment: "develop" + # environment: DATO_ENV end webpack_command = diff --git a/package.json b/package.json index 1f4a4d0d9e..b1bb15cc05 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "bootstrap-italia": "^1.4.1", "compression-webpack-plugin": "^7.0.0", "css-loader": "^5", + "datocms-client": "^3.5.9", "file-loader": "^6.2.0", "get-caller-file": "1.0.3", "glob": "^7.1.2", @@ -45,23 +46,18 @@ "svg-spritemap-webpack-plugin": ">= 3.7.1", "terser-webpack-plugin": "^5.0.3", "webpack": "^5.10.0", - "webpack-cli": ">= 3.2.1", - "webpack-modernizr-loader": "^5", - "datocms-client": "^3.5.9" + "webpack-cli": ">= 3.2.1" }, "dependencies": { "@popperjs/core": "^2.6.0", - "core-js": "^3.8.3", "focus-visible": "^5.2.0", "gh-pages": "^3.1.0", "lazysizes": "^5.2.2", "sharer.js": "^0.4.1", - "svg4everybody": "^2.1.9", "swiper": "^6.4.5" }, "browserslist": [ "last 2 versions", - "> 1%", - "IE 11" + "> 1%" ] } diff --git a/source/javascripts/index.js b/source/javascripts/index.js index 0f2993beaa..7ea5e9c2c4 100644 --- a/source/javascripts/index.js +++ b/source/javascripts/index.js @@ -10,11 +10,6 @@ import "lazysizes"; import "lazysizes/plugins/respimg/ls.respimg"; import "focus-visible/src/focus-visible.js"; import Sharer from "sharer.js/sharer.js"; -import "core-js/features/promise"; -import "core-js/features/object/assign"; -import "core-js/features/string/repeat"; -import "core-js/features/number"; -import svg4everybody from "svg4everybody"; const progressIndicator = require("progress-indicator.js"); const DatoCmsSearch = require("datocms-search.widget.js"); @@ -78,7 +73,6 @@ $(".nav-item").click(function (e) { }); initSearch(); -svg4everybody(); progressIndicator.updateProgress(); window.onscroll = function () { progressIndicator.updateProgress(); diff --git a/source/javascripts/progress-indicator.js b/source/javascripts/progress-indicator.js index 25756ec13f..6bda6a5508 100644 --- a/source/javascripts/progress-indicator.js +++ b/source/javascripts/progress-indicator.js @@ -1,44 +1,47 @@ export function updateProgress() { - $('._content').each(function(i, obj) { + $("._content").each(function (i, obj) { var winScroll = Math.abs(obj.getBoundingClientRect().top); var height = obj.getBoundingClientRect().height; var scrolled = (winScroll / height) * 100; if (obj.getBoundingClientRect().top <= 0) { - $('._progress-indicator').each(function() { + $("._progress-indicator").each(function () { this.style.width = valueLimit(scrolled, 0, 100) + "%"; - setActiveSection() - }) + setActiveSection(); + }); } else { - $('._progress-indicator').each(function() { + $("._progress-indicator").each(function () { this.style.width = 0 + "%"; - }) + }); } - }) + }); } function valueLimit(val, min, max) { - return (Math.min(max, Math.max(min, val))); + return Math.min(max, Math.max(min, val)); } function setActiveSection() { - $('._anchor').each(function(i, obj) { - if (obj.getBoundingClientRect().top <= 10 ) { - clearAllActives() - setActive($(obj).children().attr('id')) + $("._anchor").each(function (i, obj) { + if (obj.getBoundingClientRect().top <= 10) { + clearAllActives(); + setActive($(obj).children().attr("id")); } }); } function clearAllActives() { - $('.nav-item').each(function(i, obj) { - $(obj).children().removeClass('active') - }) + $(".nav-item").each(function (i, obj) { + $(obj).children().removeClass("active"); + }); } function setActive(id) { - $('._top-menu .nav-item').each(function(i, obj) { - if ($(obj).children().attr('href') === `#${id}` && !$(obj).children().hasClass('active')) { - $(obj).children().addClass('active') + $("._top-menu .nav-item").each(function (i, obj) { + if ( + $(obj).children().attr("href") === `#${id}` && + !$(obj).children().hasClass("active") + ) { + $(obj).children().addClass("active"); } - }) -} \ No newline at end of file + }); +} diff --git a/source/stylesheets/custom/_ie-fixes.scss b/source/stylesheets/custom/_ie-fixes.scss deleted file mode 100644 index 06bf3d93d4..0000000000 --- a/source/stylesheets/custom/_ie-fixes.scss +++ /dev/null @@ -1,17 +0,0 @@ -@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { - .img-fluid { - width: 100%; - } - .it-brand-text { - max-width: 60%; - } - .img-wrapper img { - width: auto !important; - height: auto !important; - min-width: 100%; - min-height: 100%; - position: absolute; - right: 50%; - transform: translate(50%, 0); - } -} diff --git a/source/stylesheets/custom/_mid-search.scss b/source/stylesheets/custom/_mid-search.scss index cddd2834c9..d1ff9e46b3 100644 --- a/source/stylesheets/custom/_mid-search.scss +++ b/source/stylesheets/custom/_mid-search.scss @@ -63,13 +63,10 @@ } .datocms-widget__pagination__page { display: -webkit-box; - display: -ms-flexbox; display: flex; -webkit-box-align: center; - -ms-flex-align: center; align-items: center; -webkit-box-pack: center; - -ms-flex-pack: center; justify-content: center; height: 2.5rem; min-width: 2.5rem; diff --git a/webpack.config.js b/webpack.config.js index 728e8fb5b6..3145d781b8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,158 +1,149 @@ -const path = require('path') -const webpack = require('webpack') -const autoprefixer = require('autoprefixer') +const path = require("path"); +const webpack = require("webpack"); +const autoprefixer = require("autoprefixer"); -const CompressionPlugin = require('compression-webpack-plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') -const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin') -const TerserPlugin = require('terser-webpack-plugin') +const CompressionPlugin = require("compression-webpack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const SVGSpritemapPlugin = require("svg-spritemap-webpack-plugin"); +const TerserPlugin = require("terser-webpack-plugin"); const extractMiniCss = new MiniCssExtractPlugin({ - filename: 'stylesheets/[name].css' -}) + filename: "stylesheets/[name].css", +}); module.exports = { entry: { - application: './source/javascripts/index.js', - styles: './source/stylesheets/_application.scss' + application: "./source/javascripts/index.js", + styles: "./source/stylesheets/_application.scss", }, resolve: { modules: [ - path.join(__dirname, 'source/stylesheets'), - path.join(__dirname, 'source/javascripts'), - 'node_modules', - 'node_modules/bootstrap', - 'node_modules/bootstrap-select', - 'node_modules/bootstrap-italia' + path.join(__dirname, "source/stylesheets"), + path.join(__dirname, "source/javascripts"), + "node_modules", + "node_modules/bootstrap", + "node_modules/bootstrap-select", + "node_modules/bootstrap-italia", ], - alias: { - modernizr$: path.resolve(__dirname, '.modernizrrc.js') - } }, output: { - path: path.resolve(__dirname, '.tmp/dist'), - filename: 'javascripts/[name].js', - publicPath: '' + path: path.resolve(__dirname, ".tmp/dist"), + filename: "javascripts/[name].js", + publicPath: "", }, module: { rules: [ - { - loader: 'webpack-modernizr-loader', - test: /\.modernizrrc\.js$/ - }, { test: /\.js$/, exclude: /(node_modules|bower_components)/, use: { - loader: 'babel-loader', + loader: "babel-loader", options: { - presets: ['@babel/preset-env'] - } - } + presets: ["@babel/preset-env"], + }, + }, }, { - enforce: 'pre', + enforce: "pre", test: /\.s[ac]ss/, - use: 'import-glob-loader' + use: "import-glob-loader", }, { test: /\.s[ac]ss$/, use: [ { loader: MiniCssExtractPlugin.loader }, - { loader: 'css-loader' }, + { loader: "css-loader" }, { - loader: 'postcss-loader', + loader: "postcss-loader", options: { - plugins: () => [autoprefixer()] - } + plugins: () => [autoprefixer()], + }, }, { - loader: 'sass-loader', + loader: "sass-loader", options: { sassOptions: { - indentedSyntax: false - } - } - } - ] + indentedSyntax: false, + }, + }, + }, + ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/i, - loader: 'file-loader', + loader: "file-loader", options: { - name: '/fonts/[name].[ext]', - } - } - ] + name: "/fonts/[name].[ext]", + }, + }, + ], }, plugins: [ new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery' + $: "jquery", + jQuery: "jquery", }), new SVGSpritemapPlugin( - [ - path.join(__dirname, 'node_modules/bootstrap-italia/src/svg/*.svg'), - ], + [path.join(__dirname, "node_modules/bootstrap-italia/src/svg/*.svg")], { output: { - filename: 'images/sprite.svg', + filename: "images/sprite.svg", svgo: { multipass: true, pretty: true, plugins: [ - {cleanupAttrs: true}, - {cleanupEnableBackground: true}, - {cleanupIDs: true}, - {cleanupListOfValues: true}, - {cleanupNumericValues: true}, - {collapseGroups: true}, - {convertColors: true}, - {convertPathData: true}, - {convertShapeToPath: true}, - {convertStyleToAttrs: true}, - {convertTransform: true}, - {mergePaths: true}, - {moveElemsAttrsToGroup: true}, - {moveGroupAttrsToElems: true}, + { cleanupAttrs: true }, + { cleanupEnableBackground: true }, + { cleanupIDs: true }, + { cleanupListOfValues: true }, + { cleanupNumericValues: true }, + { collapseGroups: true }, + { convertColors: true }, + { convertPathData: true }, + { convertShapeToPath: true }, + { convertStyleToAttrs: true }, + { convertTransform: true }, + { mergePaths: true }, + { moveElemsAttrsToGroup: true }, + { moveGroupAttrsToElems: true }, //{removeAttrs: {attrs: '(fill|stroke)'}}, // if you don't want any color from the original SVG - see also the removeStyleElement option - {removeComments: true}, - {removeDesc: false}, // for usability reasons - {removeDimensions: true}, - {removeDoctype: true}, - {removeEditorsNSData: true}, - {removeEmptyAttrs: true}, - {removeEmptyContainers: true}, - {removeEmptyText: true}, - {removeHiddenElems: true}, - {removeMetadata: true}, - {removeNonInheritableGroupAttrs: true}, - {removeRasterImages: true}, // bitmap! you shall not pass! - {removeScriptElement: true}, // shoo, javascript! + { removeComments: true }, + { removeDesc: false }, // for usability reasons + { removeDimensions: true }, + { removeDoctype: true }, + { removeEditorsNSData: true }, + { removeEmptyAttrs: true }, + { removeEmptyContainers: true }, + { removeEmptyText: true }, + { removeHiddenElems: true }, + { removeMetadata: true }, + { removeNonInheritableGroupAttrs: true }, + { removeRasterImages: true }, // bitmap! you shall not pass! + { removeScriptElement: true }, // shoo, javascript! //{removeStyleElement: true}, // if you really really want to remove ANY