rails / cssbundling-rails

Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.
MIT License
563 stars 83 forks source link

Incorrectly escaped script command #135

Closed Tikkoneus closed 9 months ago

Tikkoneus commented 9 months ago

Hello! My apologies, I'm waaaaay out of my depth so please pardon my ignorance.

When using rails new foobar -j esbuild --css bootstrap to initialize a new rails 7.0.8 app I receive:

Add watch:css script
         run  npm pkg set scripts.watch:css="nodemon --watch ./app/assets/stylesheets/ --ext scss --exec "yarn build:css"" from "."
npm ERR! code EUSAGE
npm ERR!
npm ERR! npm pkg set expects a key=value pair of args.
npm ERR!
npm ERR! Manages your package.json
npm ERR!
npm ERR! Usage:
npm ERR! npm pkg set <key>=<value> [<key>=<value> ...]
npm ERR! npm pkg get [<key> [<key> ...]]
npm ERR! npm pkg delete <key> [<key> ...]
npm ERR! npm pkg set [<array>[<index>].<key>=<value> ...]
npm ERR! npm pkg set [<array>[].<key>=<value> ...]
npm ERR! npm pkg fix
npm ERR!
npm ERR! Options:
npm ERR! [-f|--force] [--json]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces]
npm ERR!
npm ERR! Run "npm help pkg" for more info

This appears to be from the nested double quotes. By hand-editing vendor/bundle/ruby/3.2.0/gems/cssbundling-rails-1.3.2/lib/install/bootstrap/install.rb and changing line 25 from: add_package_json_script("watch:css", "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"#{bundler_run_cmd } build:css\"", false) to add_package_json_script("watch:css", "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec '#{bundler_run_cmd } build:css'", false) The error goes away. (Changed the escaped double-quotes to single quotes.)

System information:

Ubuntu 22.04.3 LTS \n \l
Linux 5.15.90.1-microsoft-standard-WSL2
node v20.6.1
npm  v9.8.1