Built-In

JS and CSS files can be optimized further using these settings:

  1. compile

  2. bundle[-es6]

  3. lint

  4. es5

  5. transform

  6. beautify

  7. minify

  8. es5-minify

  9. custom name

You can define or undefine your own optimizations in squared.json.

HTML

posthtml

@pi-r/posthtml

5

prettier

@pi-r/prettier

6

html-validate

@pi-r/html-validate

3

CSS

postcss

@pi-r/postcss

5

stylelint

@pi-r/stylelint

3

sass

@pi-r/sass

1

JS

@babel/core

@pi-r/babel

4

eslint

@pi-r/eslint

3

prettier

@pi-r/prettier

6

rollup

@pi-r/rollup

2

terser

@pi-r/terser

7

These plugins can be configured using a plain object in settings.transform. Import maps [1] are available for plugins which resolve imports through the file system. Other non-builtin transpilers can similarly be integrated by defining a custom function.

  • NPM custom package

  • Local file using module.exports (e.g. “.cjs”)

  • Local file using export default (e.g. “.mjs”)

  • Local plain file with single function (e.g. “.js”)

  • Inline function

Unmaintained

The source for these packages are located in a separate repository Pi-r2. Once per year they are published with each major NodeJS release in April.

@pi-r/html-minifier

0.7.x

N

@pi-r/uglify-js

0.7.x

Y [2]

@pi-r/html-minifier-terser

0.8.x

N

@pi-r/svgo

0.8.x

Y [2]

@pi-r/clean-css

0.9.x

N

@pi-r/csso

0.9.x

N

Tip

Pi-r2 packages are compatible with the latest E-mc and can be used as is without any problems.

Environment Variables

Plugin

Name

Value

eslint

ESLINT_USE_FLAT_CONFIG

boolean

eslint

ESLINT_FORMATTER_NAME

any

sass [3]

SASS_OPTIONS_IMPORTER_NODE_PACKAGE

path/boolean

stylelint

STYLELINT_OPTIONS_CWD

path

stylelint

STYLELINT_OPTIONS_CONFIG_FILE

path

stylelint

STYLELINT_OPTIONS_CONFIG_BASEDIR

path

stylelint

STYLELINT_OPTIONS_VALIDATE

boolean

stylelint

STYLELINT_OPTIONS_FIX

boolean

stylelint

STYLELINT_OPTIONS_FORMATTER

string

Pre-Installed

Plugin

Name

Alias

Pi-r

postcss

autoprefixer

0.10.0

postcss

postcss-import

import

0.10.0

rollup

@rollup/plugin-commonjs

commonjs

0.10.0

rollup

@rollup/plugin-node-resolve

node-resolve

0.10.0

squared.json
{
  "rollup": {
    "bundle-es6": {
      "treeshake": true,
      "plugins": [
        "node-resolve",
        "@rollup/plugin-commonjs", // "commonjs"
        ["babel", { "__default__": "babel", "babelHelpers": "bundled" }] // __default__ (@pi-r property)
      ],
      "output": {
        "format": "es",
        "preserveModules": false,
        "sourcemap": true,
        "plugins": [
          ["@rollup/plugin-terser", { "keep_classnames": true }] // npm i @rollup/plugin-terser
        ]
      }
    }
  }
}