diff --git a/babel.config.json b/babel.config.json index 013586968..fe53aefef 100644 --- a/babel.config.json +++ b/babel.config.json @@ -3,9 +3,7 @@ [ "@babel/preset-env", { - "targets": { - "node": "12" - }, + "targets": "defaults, node >= 12", "useBuiltIns": "usage", "corejs": "3.25" } diff --git a/get/index.njk b/get/index.njk index 89f5e6e21..7d0901018 100644 --- a/get/index.njk +++ b/get/index.njk @@ -18,11 +18,15 @@ Or, if you'd rather just have Color as a global variable, the class
<script src="https://colorjs.io/dist/color.global.js"></script>
-

You can also add .min right before the .js extension to get a minified file. +

You can also add .min right before the .js extension to get a minified file.

You can also import individual functions and use the tree-shakeable API.

-

To use with older platforms (e.g. Node.js 12 or 14), add .legacy right before the .js extension to get a transpiled version. +To use with older browsers (e.g. Opera v89) or platforms (e.g. Node.js v12 or v14), add .legacy right before the .js extension to get a transpiled version: + +

const Color = require("colorjs.io/dist/color.legacy.cjs").default
+ +
<script src="https://colorjs.io/dist/color.global.legacy.js"></script>

Via npm

diff --git a/package.json b/package.json index 11223e685..bb387ac96 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "import": "./dist/color.js", "require": "./dist/color.cjs" }, - "./fn": "./src/index-fn.js" + "./fn": "./src/index-fn.js", + "./dist/*": "./dist/*" }, "type": "module", "main": "./dist/color.cjs", diff --git a/rollup.legacy.config.js b/rollup.legacy.config.js index 440f626e0..3af910787 100644 --- a/rollup.legacy.config.js +++ b/rollup.legacy.config.js @@ -1,9 +1,10 @@ -import defaultConfig from './rollup.config.js'; import { babel } from "@rollup/plugin-babel"; import commonjs from "@rollup/plugin-commonjs"; import { nodeResolve } from "@rollup/plugin-node-resolve"; -let legacyPlugins = [ +import defaultConfig from './rollup.config.js'; + +const legacyPlugins = [ commonjs(), nodeResolve(), babel({ babelHelpers: "bundled", exclude: "node_modules/**" }),