Skip to content

Commit

Permalink
Merge pull request #427 from nimblehq/chore/some-minor-update
Browse files Browse the repository at this point in the history
Correct the build:css task
  • Loading branch information
malparty authored Jul 7, 2023
2 parents 46573c2 + bec259c commit 6500b69
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .template/spec/variants/web/package_json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
end

it 'adds the script for bundling css' do
expect(subject['scripts']).to include('build:css')
expect(subject['scripts']).to include('build:css-dev')
end

it 'adds the script for bundling css in production' do
expect(subject['scripts']).to include('build:css-production')
expect(subject['scripts']).to include('build:css')
end

it 'adds the script for bundling postcss' do
Expand Down
2 changes: 1 addition & 1 deletion .template/variants/web/Procfile.dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
append_to_file 'Procfile.dev' do
<<~PROCFILE
js: yarn build --watch
css: yarn build:css --watch
css: yarn build:css-dev --watch
postcss: yarn build:postcss --watch
PROCFILE
end
5 changes: 4 additions & 1 deletion .template/variants/web/app/javascript/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ const watch = process.argv.slice(2).includes('--watch');

require('esbuild')
.context({
entryPoints: ['app/javascript/application.js'],
entryPoints: [
{ in: 'app/javascript/application.js', out: 'application' },
// { in: 'engines/[engine_name]/app/javascript/[engine_name]/application.js', out: '[engine_name]/application' },
],
inject: ['app/javascript/global.js'],
bundle: true,
sourcemap: true,
Expand Down
2 changes: 1 addition & 1 deletion .template/variants/web/app/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
directory 'app/assets/stylesheets'
directory 'app/assets/builds'

run 'yarn build:css'
run 'yarn build:css-dev'
gsub_file 'app/assets/config/manifest.js', "//= link_directory ../stylesheets .css\n", ''
append_to_file 'app/assets/config/manifest.js', '//= link_tree ../builds'

Expand Down
7 changes: 3 additions & 4 deletions .template/variants/web/package.json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@

run %(npm pkg set scripts.build="node app/javascript/build.js")
run %(
npm pkg set scripts.build:css-production="sass\
#{source_stylesheet} #{bundled_stylesheet} #{production_bundled_stylesheet_options.join(' ')}"
npm pkg set scripts.build:css-dev="sass\
#{source_stylesheet} #{bundled_stylesheet} #{bundled_stylesheet_base_options.join(' ')}"
)
run %(
npm pkg set scripts.build:css="sass\
#{source_stylesheet} #{bundled_stylesheet} #{bundled_stylesheet_base_options.join(' ')}"
npm pkg set scripts.build:css="yarn build:css-dev #{production_bundled_stylesheet_options.join(' ')}"
)
run %(npm pkg set scripts.postcss="postcss\
public/assets/*.css --dir public/assets --config ./")
Expand Down

0 comments on commit 6500b69

Please sign in to comment.