Learn how to add custom JavaScript to your Spree Admin Dashboard
vendor
directory, and not in node_modules
.
That’s because we’re not using Node.js at all. So no Yarn or npm. We’re using a different approach to manage dependencies.
We’re using a tool called Importmaps to manage dependencies which is the Ruby on Rails default.
vendor/javascript
directory and add them to your config/importmap.rb
file, eg.
application.js
:
application.js
file. It’s located in the app/javascript
directory.
If you want to add custom JavaScript to your Spree Admin Dashboard, you can do so by adding a new file to the app/javascript
directory.
app/javascript/controllers
directory. It will be automatically picked up by the application.
data-controller
attribute to your element, eg.
config/initializers/spree.rb
file, eg.
app/views/spree/admin/shared/my_tracking_code.html.erb
, where you can add your tracking code, eg.