-
Notifications
You must be signed in to change notification settings - Fork 9
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 #20 from RinteRface/esbuild-improve
Handle Sass
- Loading branch information
Showing
16 changed files
with
219 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# charpente 0.0.0.9000 | ||
# charpent 0.5.0.9000 | ||
|
||
## Breaking change: | ||
- Include Sass handling. SCSS files are sorted in the `/styles`folder and esbuild | ||
has new Sass modules to treat them and generate CSS. | ||
`package.json` now calls `node esbuild.dev.js` or `node esbuild.prod.js`, | ||
depending on the selected mode, that is production or development. | ||
`esbuild.**.js` is a new script which will be processed at run time in your project, before being called by `node` in `package.json`. If you come from an older | ||
`{charpente}` version, `build_js()` will first try to create a `/styles` folder (which you normally don't have) and install missing Sass dependencies next to esbuild (`esbuild-sass-plugin`, `postcss`, `autoprefixer`). | ||
- `get_dependency_assets()` leverages the new jsdlivr algorithm to infer the best entry point scripts for JS and CSS files, when downloading dependencies within `create_dependency()`. | ||
This likely will change your vendors dependencies scripts names but should not change the features. | ||
- `charpente_options()` will likely be deprecated because of the previous point. It still | ||
contains the local option to either point to external CDN or copy external vendore files | ||
into the local project. | ||
- `create_css()` has been replaced by `create_scss()` (you can still use `golem::create_css`). | ||
There is one main SCSS file created at project setup. Other SCSS files are referenced into this main `styles/main.scss` using `@import path`, which will allow you to have modular | ||
Sass code. | ||
- Remove `entry_point` param from `build_js()` as it was not used anyway... | ||
|
||
# charpente 0.1.0 | ||
|
||
* Added a `NEWS.md` file to track changes to the package. |
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
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,23 @@ | ||
import esbuild from "esbuild"; | ||
import {sassPlugin} from 'esbuild-sass-plugin'; | ||
import postcss from 'postcss'; | ||
import autoprefixer from 'autoprefixer'; | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ["./srcjs/main.js"], | ||
outfile: "inst/<<name>>-<<version>>/dist/<<name>>.js", | ||
bundle: true, | ||
format: "esm", | ||
minify: false, // dev | ||
plugins: [ | ||
sassPlugin({ | ||
async transform(source) { | ||
const { css } = await postcss([autoprefixer]).process(source); | ||
return css; | ||
}, | ||
}), | ||
] | ||
}) | ||
.then(() => console.log("⚡ Build complete! ⚡")) | ||
.catch(() => process.exit(1)); |
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,24 @@ | ||
import esbuild from "esbuild"; | ||
import {sassPlugin} from 'esbuild-sass-plugin'; | ||
import postcss from 'postcss'; | ||
import autoprefixer from 'autoprefixer'; | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ["./srcjs/main.js"], | ||
outfile: "inst/<<name>>-<<version>>/dist/<<name>>.min.js", | ||
bundle: true, | ||
format: "esm", | ||
minify: true, // prod | ||
sourcemap: "external", // prod | ||
plugins: [ | ||
sassPlugin({ | ||
async transform(source) { | ||
const { css } = await postcss([autoprefixer]).process(source); | ||
return css; | ||
}, | ||
}), | ||
] | ||
}) | ||
.then(() => console.log("⚡ Build complete! ⚡")) | ||
.catch(() => process.exit(1)); |
Oops, something went wrong.