Skip to content

Commit

Permalink
Add default browser support
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Sep 30, 2022
1 parent 862425c commit d008c58
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 1 addition & 3 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
[
"@babel/preset-env",
{
"targets": {
"node": "12"
},
"targets": "defaults, node >= 12",
"useBuiltIns": "usage",
"corejs": "3.25"
}
Expand Down
8 changes: 6 additions & 2 deletions get/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ Or, if you'd rather just have <code>Color</code> as a global variable, the class

<pre class="language-markup"><code>&lt;script src="https://colorjs.io/dist/color.global.js">&lt;/script></code></pre>

<p class="tip">You can also add <code>.min</code> right before the <code>.js</code> extension to get a minified file.
<p class="tip">You can also add <code>.min</code> right before the <code>.js</code> extension to get a minified file.</p>

<p>You can also <a href="/docs/procedural.html">import individual functions and use the tree-shakeable API</a>.</p>

<p class="tip">To use with older platforms (e.g. Node.js 12 or 14), add <code>.legacy</code> right before the <code>.js</code> 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 <code>.legacy</code> right before the <code>.js</code> extension to get a transpiled version:

<pre><code>const Color = require("colorjs.io/dist/color.legacy.cjs").default</code></pre>

<pre class="language-markup"><code>&lt;script src="https://colorjs.io/dist/color.global.legacy.js">&lt;/script></code></pre>

<h2>Via npm</h2>

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions rollup.legacy.config.js
Original file line number Diff line number Diff line change
@@ -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/**" }),
Expand Down

0 comments on commit d008c58

Please sign in to comment.