Skip to content

Commit

Permalink
feat: allow for an encapsulated postcss & babel config
Browse files Browse the repository at this point in the history
  • Loading branch information
KonnorRogers committed Jul 26, 2020
1 parent 596df4a commit f95e15a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/snowpacker/snowpacker_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ def create_initializer_file
desc 'Add snowpack, babel, and postcss to your package.json dependencies'
def add_snowpack
`yarn add -D snowpack \
@snowpack/plugin-babel \
@snowpack/babel-plugin-package-import
@snowpack/babel-plugin-package-import \
core-js@3 \
postcss \
postcss-cli \
Expand Down
7 changes: 5 additions & 2 deletions lib/snowpacker/templates/snowpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const scripts = {
"mount:web_modules": `mount web_modules --to /${output_path}`,
"mount:__snowpack__": `mount __snowpack__ --to /${output_path}`,
"mount:snowpacks": `mount ${mount_dir} --to /${output_path}`,
"build:css": `postcss --config ${postcss_config}`
"build:css": `postcss --config ${postcss_config}`,
"build:js,jsx,ts,tsx": `babel --config-file ${babel_config} \
--out-dir ${process.cwd()} \
${mount_dir}`
}

const installOptions = {
Expand All @@ -31,7 +34,7 @@ const buildOptions = {

module.exports = {
scripts,
plugins: ["@snowpack/plugin-babel", "@snowpack/babel-plugin-package-import"],
plugins: ["@snowpack/babel-plugin-package-import"],
installOptions,
devOptions,
buildOptions
Expand Down

0 comments on commit f95e15a

Please sign in to comment.