Created
February 15, 2022 14:45
-
-
Save mikenewbuild/2eaddfb3f5bbca0d1d07908c61725daf to your computer and use it in GitHub Desktop.
Esbuild config for Shopify Themes
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
import esbuild from "esbuild"; | |
import { sassPlugin } from "esbuild-sass-plugin"; | |
import postcss from "postcss"; | |
import autoprefixer from "autoprefixer"; | |
import postcssPresetEnv from "postcss-preset-env"; | |
esbuild | |
.build({ | |
entryPoints: { | |
theme: "src/scripts/theme.js", | |
}, | |
bundle: true, | |
outdir: "assets", | |
target: ["es2018"], | |
plugins: [ | |
sassPlugin({ | |
async transform(source, resolveDir) { | |
const { css } = await postcss([ | |
autoprefixer, | |
postcssPresetEnv({ stage: 0 }), | |
]).process(source, { from: undefined }); | |
return css; | |
}, | |
}), | |
], | |
minify: true, | |
watch: true, | |
sourcemap: true, | |
}) | |
.then(() => { | |
console.log("Watching files..."); | |
}) | |
.catch((e) => console.error(e.message)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment