-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from kohlmannj/local-css
feat: add support for `type: 'local-css'`
- Loading branch information
Showing
12 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### Example `build.js` | ||
```javascript | ||
const esbuild = require("esbuild"); | ||
const {sassPlugin, postcssModules} = require("esbuild-sass-plugin"); | ||
|
||
esbuild.build({ | ||
entryPoints: ["./src/index.js"], | ||
outdir: "build/", | ||
bundle: true, | ||
format: "esm", | ||
plugins: [ | ||
sassPlugin({ | ||
type: 'local-css' | ||
}), | ||
] | ||
}).catch(() => process.exit(1)); | ||
``` | ||
|
||
### ...remember the dependencies in `package.json` | ||
```json | ||
"dependencies": { | ||
... | ||
"esbuild": "^0.12.20", | ||
"esbuild-sass-plugin": "^1.5.0" | ||
... | ||
} | ||
``` | ||
|
||
**Note**: | ||
|
||
This project is slightly different from the example because it's part of the fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const esbuild = require('esbuild') | ||
const {sassPlugin} = require('../../../lib') | ||
const {cleanFixture, logSuccess, logFailure} = require('../utils') | ||
|
||
cleanFixture(__dirname) | ||
|
||
esbuild.build({ | ||
entryPoints: ['./src/index.js'], | ||
outdir: './out', | ||
bundle: true, | ||
format: 'esm', | ||
plugins: [ | ||
sassPlugin({ | ||
type: 'local-css' | ||
}), | ||
] | ||
}).then(logSuccess, logFailure) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Bootstrap Example</title> | ||
<link href="out/index.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<script src="out/index.js" type="text/javascript"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "local-css-fixture", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "node ./build", | ||
"serve": "node ../serve css-modules" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.message { | ||
font-family: Roboto, sans-serif; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.message { | ||
color: white; | ||
background-color: red; | ||
font-size: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { message } from "./example.module.scss"; | ||
import * as common from "./common.module.scss"; | ||
|
||
document.body.insertAdjacentHTML("afterbegin", ` | ||
<div class="${message} ${common.message}">Hello World</div> | ||
`); |