@tuqulore-inc/eleventy-plugin-postcss 0.0.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) tuqulore inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,45 +1,62 @@
1
1
  # @tuqulore-inc/eleventy-plugin-postcss
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ Eleventy plugin for processing CSS with PostCSS.
4
4
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
5
+ ## Installation
6
6
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
7
+ ```bash
8
+ npm install -D @11ty/eleventy postcss @tuqulore-inc/eleventy-plugin-postcss
9
+ ```
8
10
 
9
- ## Purpose
11
+ ## Usage
10
12
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@tuqulore-inc/eleventy-plugin-postcss`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
13
+ ```javascript
14
+ // eleventy.config.mjs
15
+ import postcss from "@tuqulore-inc/eleventy-plugin-postcss";
15
16
 
16
- ## What is OIDC Trusted Publishing?
17
+ export default function (eleventyConfig) {
18
+ eleventyConfig.addPlugin(postcss, {
19
+ contentGlob: ["src/**/*.{md,mdx,jsx}"],
20
+ });
21
+ }
22
+ ```
17
23
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
24
+ This plugin requires a PostCSS configuration file (`postcss.config.mjs` or `postcss.config.js`) in your project root:
19
25
 
20
- ## Setup Instructions
26
+ ```javascript
27
+ // postcss.config.mjs
28
+ export default {
29
+ plugins: {
30
+ "@tailwindcss/postcss": {},
31
+ },
32
+ };
33
+ ```
21
34
 
22
- To properly configure OIDC trusted publishing for this package:
35
+ ## Options
23
36
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
37
+ ### `contentGlob`
28
38
 
29
- ## DO NOT USE THIS PACKAGE
39
+ - Type: `string | string[]`
40
+ - Default: `[]`
30
41
 
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
42
+ Glob patterns for files to track as dependencies. When any of these files change, the CSS will be rebuilt. This is useful for TailwindCSS which scans content files for class names.
36
43
 
37
- ## More Information
44
+ When using `contentGlob`, you should also configure `setServerOptions` to watch the generated CSS files for dev server reload:
38
45
 
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
46
+ ```javascript
47
+ eleventyConfig.addPlugin(postcss, {
48
+ contentGlob: ["src/**/*.{md,mdx,jsx}"],
49
+ });
50
+ eleventyConfig.setServerOptions({
51
+ watch: ["dist/**/*.css"],
52
+ });
53
+ ```
42
54
 
43
- ---
55
+ ## Requirements
44
56
 
45
- **Maintained for OIDC setup purposes only**
57
+ - Eleventy 3.0 or higher
58
+ - PostCSS 8.0 or higher
59
+
60
+ ## License
61
+
62
+ MIT
package/index.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { UserConfig } from "@11ty/eleventy";
2
+
3
+ export interface PluginOptions {
4
+ /**
5
+ * Glob patterns for files to track as dependencies.
6
+ * When any of these files change, the CSS will be rebuilt.
7
+ * Useful for TailwindCSS which scans content files for class names.
8
+ */
9
+ contentGlob?: string | string[];
10
+ }
11
+
12
+ /**
13
+ * Eleventy plugin for processing CSS with PostCSS
14
+ */
15
+ declare function postcssPlugin(
16
+ eleventyConfig: UserConfig,
17
+ pluginOptions?: PluginOptions,
18
+ ): void;
19
+
20
+ export default postcssPlugin;
package/index.mjs ADDED
@@ -0,0 +1,44 @@
1
+ import fg from "fast-glob";
2
+ import postcss from "postcss";
3
+ import postcssrc from "postcss-load-config";
4
+
5
+ /**
6
+ * Eleventy plugin for processing CSS with PostCSS
7
+ * @param {import("@11ty/eleventy").UserConfig} eleventyConfig - Eleventy configuration object
8
+ * @param {Object} pluginOptions - Plugin options
9
+ * @param {string|string[]} [pluginOptions.contentGlob] - Glob patterns for dependency tracking
10
+ */
11
+ export default function (eleventyConfig, pluginOptions = {}) {
12
+ try {
13
+ eleventyConfig.versionCheck(">=3.0");
14
+ } catch (e) {
15
+ console.log(`[eleventy-plugin-postcss] WARN: ${e.message}`);
16
+ }
17
+
18
+ const { contentGlob = [] } = pluginOptions;
19
+ const contentPatterns = Array.isArray(contentGlob)
20
+ ? contentGlob
21
+ : [contentGlob];
22
+
23
+ eleventyConfig.addTemplateFormats("css");
24
+ eleventyConfig.addExtension("css", {
25
+ outputFileExtension: "css",
26
+ compile: async function (content, inputPath) {
27
+ if (contentPatterns.length > 0) {
28
+ const deps = await fg(contentPatterns);
29
+ this.addDependencies(inputPath, deps);
30
+ }
31
+ const { plugins, options } = await postcssrc({ from: inputPath });
32
+ const result = await postcss(plugins).process(content, {
33
+ ...options,
34
+ from: inputPath,
35
+ });
36
+ result.warnings?.().forEach((warning) => {
37
+ console.warn(
38
+ `[eleventy-plugin-postcss] ${warning.node?.source?.input?.file ?? inputPath}: ${warning.text}`,
39
+ );
40
+ });
41
+ return () => result.css;
42
+ },
43
+ });
44
+ }
package/package.json CHANGED
@@ -1,10 +1,49 @@
1
1
  {
2
2
  "name": "@tuqulore-inc/eleventy-plugin-postcss",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @tuqulore-inc/eleventy-plugin-postcss",
3
+ "version": "4.0.0",
4
+ "description": "Eleventy plugin for processing CSS with PostCSS",
5
5
  "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
10
- }
6
+ "eleventy",
7
+ "eleventy-plugin",
8
+ "postcss",
9
+ "css"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/tuqulore/website-boilerplate.git",
14
+ "directory": "packages/eleventy-plugin-postcss"
15
+ },
16
+ "license": "MIT",
17
+ "author": "tuqulore inc.",
18
+ "type": "module",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./index.d.ts",
22
+ "default": "./index.mjs"
23
+ }
24
+ },
25
+ "main": "./index.mjs",
26
+ "files": [
27
+ "README.md",
28
+ "index.d.ts",
29
+ "index.mjs"
30
+ ],
31
+ "dependencies": {
32
+ "fast-glob": "^3.3.3",
33
+ "postcss-load-config": "^6.0.1"
34
+ },
35
+ "devDependencies": {
36
+ "eslint": "^9.39.2",
37
+ "@tuqulore-inc/eslint-config": "4.0.0"
38
+ },
39
+ "peerDependencies": {
40
+ "@11ty/eleventy": ">=3.0.0",
41
+ "postcss": ">=8.0.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "scripts": {
47
+ "lint": "eslint --fix ."
48
+ }
49
+ }