Skip to content
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
eca76ab
feat: added PostCSS plugin
mfranzke Jul 19, 2025
133897a
Update packages/postcss-css-if/demo.js
mfranzke Jul 19, 2025
dcd6270
Merge branch 'main' into feat-added-postcss-plugin
mfranzke Jul 19, 2025
c15a35d
refactor: updated from main
mfranzke Jul 19, 2025
4dd8a80
refactor: renamed for clarity
mfranzke Jul 19, 2025
f691d2c
refactor: further optimizations
mfranzke Jul 19, 2025
bfa7275
Merge branch 'main' into feat-added-postcss-plugin
mfranzke Jul 19, 2025
425baab
refactor: further optimization
mfranzke Jul 19, 2025
b55030a
Merge branch 'feat-added-postcss-plugin' of https://github.com/mfranz…
mfranzke Jul 19, 2025
6535537
refactor: optimization
mfranzke Jul 19, 2025
12641e8
refactor: added license
mfranzke Jul 19, 2025
b1ac701
refactor: optimization
mfranzke Jul 19, 2025
e1326eb
docs: root README optimization
mfranzke Jul 19, 2025
a3ddbfc
refactor: removed obsolete script
mfranzke Jul 19, 2025
3a3c94d
refactor: consolidated docs
mfranzke Jul 19, 2025
a494995
Update package.json
mfranzke Jul 19, 2025
57ff894
Merge branch 'feat-added-postcss-plugin' of https://github.com/mfranz…
mfranzke Jul 19, 2025
da443f1
refactor: regenerated package lock file
mfranzke Jul 19, 2025
7cb470a
Create rich-zebras-agree.md
mfranzke Jul 19, 2025
b5b6829
docs: optimized README
mfranzke Jul 19, 2025
af5b7a5
fix: code
mfranzke Jul 19, 2025
4b7afd7
Merge branch 'feat-added-postcss-plugin' of https://github.com/mfranz…
mfranzke Jul 19, 2025
2fd6d43
refactor: corrected package version
mfranzke Jul 19, 2025
5bd44d4
refactor: corrected import
mfranzke Jul 19, 2025
0be0dee
refactor: finalized
mfranzke Jul 19, 2025
4e7d9a1
Merge branch 'main' into feat-added-postcss-plugin
mfranzke Jul 19, 2025
8710e68
refactor: added missing script
mfranzke Jul 19, 2025
a4e44d4
refactor: not treating this as a module, but cjs
mfranzke Jul 19, 2025
59f5ff4
refactor: we need to call all workspaces
mfranzke Jul 19, 2025
286812a
refactor: added missing dependencies
mfranzke Jul 19, 2025
a8a1e0e
refactor: we don't need to create the performance tests at runtime
mfranzke Jul 19, 2025
233d04a
refactor: optimized the performance tests
mfranzke Jul 19, 2025
9c8c87b
refactor: rewritten code regarding the consolidated export
mfranzke Jul 19, 2025
81714c9
refactor: corrected path
mfranzke Jul 19, 2025
e0456ac
refactor: do we actually need the try/catch ?
mfranzke Jul 19, 2025
3f7138c
refactor: another try
mfranzke Jul 19, 2025
9c910b9
refactor: we only need this build once
mfranzke Jul 19, 2025
3959152
fix: path
mfranzke Jul 19, 2025
9bddff6
refactor: corrected the path
mfranzke Jul 19, 2025
6cc4a96
refactor: renamed for clarity
mfranzke Jul 19, 2025
9cd9a75
Update package.json
mfranzke Jul 20, 2025
2020615
Merge branch 'main' into feat-added-postcss-plugin
mfranzke Jul 20, 2025
7003322
Update README.md
mfranzke Jul 20, 2025
df3dbd3
Update README.md
mfranzke Jul 20, 2025
7ea5431
refactor: let's remove this for the moment
mfranzke Jul 20, 2025
56bfb52
Merge branch 'feat-added-postcss-plugin' of https://github.com/mfranz…
mfranzke Jul 20, 2025
bb6e3f1
refactor: corrected path
mfranzke Jul 20, 2025
c7d978e
refactor: extracted site
mfranzke Jul 20, 2025
69c4459
Merge branch 'main' into feat-added-postcss-plugin
mfranzke Jul 20, 2025
feef998
Apply suggestions from code review
mfranzke Jul 20, 2025
0e7a598
Update packages/postcss-if-function/README.md
mfranzke Jul 20, 2025
ef96a2b
refactor: removed redundant file
mfranzke Jul 20, 2025
a612d8b
refactor: corrected syntax
mfranzke Jul 20, 2025
95e0b42
Revert "refactor: let's remove this for the moment"
mfranzke Jul 20, 2025
e117461
refactor: renamed for clarity
mfranzke Jul 20, 2025
75ccf4e
refactor: not mixing named and default exports
mfranzke Jul 20, 2025
6c307c7
refactor: corrected test cases and documentation regarding the syntax
mfranzke Jul 20, 2025
f23034c
docs: nevermind
mfranzke Jul 20, 2025
2553682
test: we don't need this, as it's not based on the web standard
mfranzke Jul 20, 2025
65c4dbe
test: clarity
mfranzke Jul 20, 2025
203d532
refactor: changed vendor
mfranzke Jul 20, 2025
a67a6a4
refactor(docs): optimized structure
mfranzke Jul 20, 2025
b2acf45
Apply suggestions from code review
mfranzke Jul 20, 2025
69150f7
Update README.md
mfranzke Jul 20, 2025
434c765
refactor: moved this file
mfranzke Jul 20, 2025
d4b2c73
Merge branch 'feat-added-postcss-plugin' of https://github.com/mfranz…
mfranzke Jul 20, 2025
7d9a18a
docs: mentioning a possible future refactoring
mfranzke Jul 20, 2025
cef6db3
Apply suggestions from code review
mfranzke Jul 20, 2025
a06acc3
Update packages/postcss-if-function/test/plugin.test.js
mfranzke Jul 20, 2025
073fd68
Apply suggestions from code review
mfranzke Jul 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/rich-zebras-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"css-if-polyfill": patch
"postcss-if-function": minor
---

feat: added PostCSS plugin
116 changes: 116 additions & 0 deletions .github/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSS if() Polyfill - Examples</title>
<style>
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
line-height: 1.6;
}
.example-list {
list-style: none;
padding: 0;
}
.example-list li {
margin: 10px 0;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
background: #f9f9f9;
}
.example-list a {
text-decoration: none;
color: #0066cc;
font-weight: bold;
}
.example-list a:hover {
text-decoration: underline;
}
.cdn-info {
background: #e7f3ff;
padding: 15px;
border-radius: 5px;
margin: 20px 0;
}
.cdn-info code {
background: #f0f0f0;
padding: 2px 4px;
border-radius: 3px;
}
</style>
</head>
<body>
<h1>CSS if() Polyfill - Live Examples</h1>

<p>
This page showcases live examples of the CSS if() polyfill in
action. Each example demonstrates different aspects of the
polyfill's functionality.
</p>

<div class="cdn-info">
<h3>CDN Usage</h3>
<p>You can include the polyfill directly from jsDelivr:</p>
<code
>https://cdn.jsdelivr.net/npm/css-if-polyfill/dist/index.modern.js</code
>
</div>

<h2>Available Examples</h2>
<ul class="example-list">
<li>
<a href="examples/basic-examples.html">Basic Examples</a>
<br /><small
>Demonstrates basic if() syntax with style(), media(), and
supports() conditions</small
>
</li>
<li>
<a href="examples/enhanced.html">Enhanced Features</a>
<br /><small
>Shows advanced usage patterns and edge cases</small
>
</li>
<li>
<a href="examples/multiple-conditions.html"
>Multiple Conditions</a
>
<br /><small
>Examples with multiple conditions within a single if()
function</small
>
</li>
<li>
<a href="examples/advanced.html">Advanced Usage</a>
<br /><small>Complex scenarios and real-world use cases</small>
</li>
<li>
<a href="examples/media-query-tracking.html"
>Media Query Tracking</a
>
<br /><small
>Demonstrates automatic media query change detection and
responsive updates</small
>
</li>
</ul>

<h2>Project Information</h2>
<p>
<a href="https://github.com/mfranzke/css-if-polyfill"
>View on GitHub</a
>
|
<a href="https://www.npmjs.com/package/css-if-polyfill"
>View on npm</a
>
</p>
</body>
</html>
29 changes: 29 additions & 0 deletions .github/scripts/prepare-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

echo "Preparing GitHub Pages content..."

# Create pages directory
mkdir -p _site

# Copy examples folder
echo "Copying examples..."
mkdir -p _site/examples
cp -r examples/* _site/examples/

# Copy dist folder for example pages to access the scripts
echo "Copying dist folder..."
mkdir -p _site/dist
cp -r packages/css-if-polyfill/dist/* _site/dist/

# Copy the index.html template
echo "Copying index.html template..."
cp .github/pages/index.html _site/index.html

# Update example files to use the built polyfill from dist
echo "Updating example script references..."
find _site -name "*.html" -not -name "index.html" -exec sed -i.bak 's|../src/index.js|./dist/index.modern.js|g' {} \;
# Clean up backup files
find _site -name "*.bak" -delete

echo "GitHub Pages content prepared in _site/"
107 changes: 1 addition & 106 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,112 +46,7 @@ jobs:
run: npm run build

- name: Prepare GitHub Pages content
run: |
# Create pages directory
mkdir -p _site

# Copy examples folder
mkdir -p _site/examples
cp -r examples/* _site/examples/

# Copy dist folder for example pages to access the scripts
mkdir -p _site/dist
cp -r dist/* _site/dist/

# Create index.html that lists all examples
cat > _site/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS if() Polyfill - Examples</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
line-height: 1.6;
}
.example-list {
list-style: none;
padding: 0;
}
.example-list li {
margin: 10px 0;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
background: #f9f9f9;
}
.example-list a {
text-decoration: none;
color: #0066cc;
font-weight: bold;
}
.example-list a:hover {
text-decoration: underline;
}
.cdn-info {
background: #e7f3ff;
padding: 15px;
border-radius: 5px;
margin: 20px 0;
}
.cdn-info code {
background: #f0f0f0;
padding: 2px 4px;
border-radius: 3px;
}
</style>
</head>
<body>
<h1>CSS if() Polyfill - Live Examples</h1>

<p>This page showcases live examples of the CSS if() polyfill in action. Each example demonstrates different aspects of the polyfill's functionality.</p>

<div class="cdn-info">
<h3>CDN Usage</h3>
<p>You can include the polyfill directly from jsDelivr:</p>
<code>https://cdn.jsdelivr.net/npm/css-if-polyfill/dist/index.modern.js</code>
</div>

<h2>Available Examples</h2>
<ul class="example-list">
<li>
<a href="examples/basic-examples.html">Basic Examples</a>
<br><small>Demonstrates basic if() syntax with style(), media(), and supports() conditions</small>
</li>
<li>
<a href="examples/enhanced.html">Enhanced Features</a>
<br><small>Shows advanced usage patterns and edge cases</small>
</li>
<li>
<a href="examples/multiple-conditions.html">Multiple Conditions</a>
<br><small>Examples with multiple conditions within a single if() function</small>
</li>
<li>
<a href="examples/advanced.html">Advanced Usage</a>
<br><small>Complex scenarios and real-world use cases</small>
</li>
<li>
<a href="examples/media-query-tracking.html">Media Query Tracking</a>
<br><small>Demonstrates automatic media query change detection and responsive updates</small>
</li>
</ul>

<h2>Project Information</h2>
<p>
<a href="https://github.com/mfranzke/css-if-polyfill">View on GitHub</a> |
<a href="https://www.npmjs.com/package/css-if-polyfill">View on npm</a>
</p>
</body>
</html>
EOF

# Update example files to use the built polyfill from dist
find _site -name "*.html" -not -name "index.html" -exec sed -i 's|../src/index.js|./dist/index.modern.js|g' {} \;
run: ./.github/scripts/prepare-pages.sh

- name: Setup GitHub Pages
uses: actions/configure-pages@v5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ jobs:
## ESM Import

```javascript
import CSSIfPolyfill from 'css-if-polyfill';
import { init } from 'css-if-polyfill';

// Initialize the polyfill
CSSIfPolyfill.init();
init();
```

## CommonJS Require

```javascript
const CSSIfPolyfill = require('css-if-polyfill');
const { init } = require('css-if-polyfill');

// Initialize the polyfill
CSSIfPolyfill.init();
init();
```

## API Reference
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance-optimized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
echo "### Performance Report" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "Bundle sizes:" >> $GITHUB_STEP_SUMMARY
ls -lh dist/ >> $GITHUB_STEP_SUMMARY
ls -lh packages/css-if-polyfill/dist/ >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

- name: Comment performance results
Expand Down
Loading
Loading