Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a sails.js skeleton so I can quickly build new apps with common goals?

This is more for some fun and playing around with, but hopefully should produce something useful.

I would like to extend sails.js framework so that when I generate a new app using 'sails new project-name' it will already have a lot of previous configurations or modules added. For example, with every project I would probably intend to use SASS. If you have had to setup SASS with sails before you will know it has a few bits of configuration to do first. It would be advantageous to not have to repeat this with each new project.

In short some things I would like to achieve upon creating each new project:

  • Get SASS configured
  • Generate multiple SASS partial files, such as _buttons.scss, _forms.scss
  • Include SASS mixings within certain SASS files
  • Include configuration and set up to use multiple databases like mongoDB and MariaDB (Much more complex I imagine)

Thanks

like image 461
mrpetem Avatar asked Jan 25 '26 04:01

mrpetem


1 Answers

At Balderdash we do this all the time to quickly spin up certain "types" of application.

You can fork https://github.com/balderdashy/sails-generate-new and customize it to call additional generators that you can create using ejs templates.

I created a module called sails-generate-entities which you can see in use here: https://github.com/tjwebb/sails-permissions/blob/master/index.js. For this sails extension, you'd call sails generate permissions-api and all those files would be added to the project. Your fork of sails-generate-new could include a call to a custom generator such as this.

like image 51
Travis Webb Avatar answered Jan 27 '26 18:01

Travis Webb