From 2f6406150cf2d6ee2ed3a3982ebf1c8daa0021c3 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Thu, 2 Feb 2023 15:42:39 -0600 Subject: [PATCH] Rename the root plugin file --- README.md | 6 +-- eleventy.config.js => eleventy.bundle.js | 0 package.json | 2 +- test/test.js | 48 +++++++++--------------- 4 files changed, 21 insertions(+), 35 deletions(-) rename eleventy.config.js => eleventy.bundle.js (100%) diff --git a/README.md b/README.md index 4a7884c..c4dedf1 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ Makes implementing Critical CSS, per-page in-use-only CSS/JS bundles, SVG icon l ## Why? -This project is a minimum-viable-plugin for an asset pipeline in Eleventy. It does not perform any transpilation or code manipulation. The code you put in is the code you get out (with configurable hooks for more). +This project is a minimum-viable-bundler and asset pipeline in Eleventy. It does not perform any transpilation or code manipulation (by default). The code you put in is the code you get out (with configurable `transforms` if you’d like to modify the code). -For more complex features you may want to use a more full featured bundler like Vite, Parcel, Webpack, rollup, esbuild, or others. +For more larger, more complex use cases you may want to use a more full featured bundler like Vite, Parcel, Webpack, rollup, esbuild, or others. -Bundling has a significant build performance cost, so take care to weigh the cost of using a full-featured Bundler against whether or not this plugin has sufficient functionality for your needs—especially as the platform matures and we see diminishing returns on code transpilation. +But do note that a full-featured bundler has a significant build performance cost, so take care to weigh the cost of using that style of bundler against whether or not this plugin has sufficient functionality for your use case—especially as the platform matures and we see diminishing returns on code transpilation (ES modules everywhere). ## Installation diff --git a/eleventy.config.js b/eleventy.bundle.js similarity index 100% rename from eleventy.config.js rename to eleventy.bundle.js diff --git a/package.json b/package.json index 8c3fdea..0e414a8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@11ty/eleventy-plugin-bundle", "version": "1.0.0", "description": "Little bundles of code, little bundles of joy.", - "main": "eleventy.config.js", + "main": "eleventy.bundle.js", "scripts": { "sample": "DEBUG=Eleventy:Bundle npx @11ty/eleventy --config=sample/sample-config.js --input=sample", "test": "npx ava" diff --git a/test/test.js b/test/test.js index 9a1ba49..d330eda 100644 --- a/test/test.js +++ b/test/test.js @@ -11,8 +11,7 @@ function normalize(str) { } test("CSS (Nunjucks)", async t => { - // automatically uses eleventy.config.js in root - let elev = new Eleventy("test/stubs/nunjucks/"); + let elev = new Eleventy("test/stubs/nunjucks/", null, { configPath: "eleventy.bundle.js" }); let results = await elev.toJSON(); t.deepEqual(normalize(results[0].content), ` @@ -108,8 +101,7 @@ test("CSS, two buckets", async t => { }); test("CSS, two buckets, explicit `default`", async t => { - // automatically uses eleventy.config.js in root - let elev = new Eleventy("test/stubs/liquid-buckets-default/"); + let elev = new Eleventy("test/stubs/liquid-buckets-default/", null, { configPath: "eleventy.bundle.js" }); let results = await elev.toJSON(); t.deepEqual(normalize(results[0].content), ` @@ -119,8 +111,7 @@ test("CSS, two buckets, explicit `default`", async t => { }); test("CSS, get two buckets at once", async t => { - // automatically uses eleventy.config.js in root - let elev = new Eleventy("test/stubs/buckets-get-multiple/"); + let elev = new Eleventy("test/stubs/buckets-get-multiple/", null, { configPath: "eleventy.bundle.js" }); let results = await elev.toJSON(); t.deepEqual(normalize(results[0].content), ` `); }); @@ -220,8 +207,8 @@ test("Bundle in Layout file", async t => { test("Bundle with render plugin", async t => { const sass = require("sass"); - // automatically uses eleventy.config.js in root let elev = new Eleventy("test/stubs/bundle-render/", undefined, { + configPath: "eleventy.bundle.js", config: function(eleventyConfig) { eleventyConfig.addPlugin(EleventyRenderPlugin); @@ -249,8 +236,7 @@ h1 .test { }); test("No bundling", async t => { - // automatically uses eleventy.config.js in root - let elev = new Eleventy("test/stubs/no-bundles/"); + let elev = new Eleventy("test/stubs/no-bundles/", null, { configPath: "eleventy.bundle.js" }); let results = await elev.toJSON(); t.deepEqual(normalize(results[0].content), `