Skip to main content

Create a new javascript

Logic, that does not belong to a specific page or layout, should be put into general JavaScript files.

This can be a service, a utility, helper, api or any other general JavaScript code.

They are stored in your project at app/assets/js.

To structure your code better, you can create sub folders inside app/assets/js, e.g. services, utils, api etc.

To add a custom, general JavaScript file to your Sipa project, use the Sipa CLI with its generators at the root directory of your Sipa project, so it will be included into the app automatically:

# start generator
sipa g
# choose javascript
j
# enter javascript name for e.g. my custom js
my-custom-service