mediawiki-skins-MinervaNeue/dev-scripts/bundlesize.sh
jdlrobson 7340485014 Monitor render blocking css bundle sizes
Add a script that builds CSS for Minerva using lessc than measures
their bundlesize.

This will give us added protection to large increases in bundlesize
that can lead to performance regressions.

Change-Id: I2e5e55ad10fac7ecb5a8c19ccdf3cc54de59b75d
2020-01-29 11:03:59 +00:00

32 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
function setUp() {
mkdir -p tmp .resolve-less-imports/mediawiki.ui
}
function tearDown() {
rm -r tmp .resolve-less-imports
}
trap tearDown EXIT
setUp
curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.mixins.less?view=raw" -o .resolve-less-imports/mediawiki.mixins.less -L
curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.ui/variables.less?view=raw" -o .resolve-less-imports/mediawiki.ui/variables.less -L
curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.mixins.rotation.less?view=raw" -o .resolve-less-imports/mediawiki.mixins.rotation.less -L
curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.mixins.animation.less?view=raw" -o .resolve-less-imports/mediawiki.mixins.animation.less -L
# Append compatibility with wgMinervaApplyKnownTemplateHacks.
echo "@wgMinervaApplyKnownTemplateHacks: 1;" >> .resolve-less-imports/mediawiki.ui/variables.less
# Build the render blocking bundles for testing
npx lessc resources/skins.minerva.base.styles/index.less tmp/skins.minerva.base.styles.css --include-path=".resolve-less-imports"
npx lessc resources/skins.minerva.content.styles/index.less tmp/skins.minerva.content.styles.css --include-path=".resolve-less-imports"
npx lessc resources/skins.minerva.amc.styles/index.less tmp/skins.minerva.amc.styles.css --include-path=".resolve-less-imports"
npx lessc resources/skins.minerva.mainMenu.styles/index.less tmp/skins.minerva.mainMenu.styles.css --include-path=".resolve-less-imports"
npx bundlesize