Reputation: 9455
We are considering porting our project to Sails.js. Our static assets are quite large - more than 3 GB. So, this has created a serious limitation as it doubles the size of our app. Can we modify Sails js to prevent this default behavior or can some one recommend some other framework?
Upvotes: 2
Views: 1595
Reputation: 31
In Sails.js 0.11 you may just add next code to .sailsrc file:
"hooks": { "grunt": false }
Upvotes: 0
Reputation: 24958
Sails uses Grunt to copy your assets into (by default) a clean .tmp/public folder every time the app is lifted. This allows you to pick and choose which assets should be made public, and also lets you compile and minify assets in different environments. This doesn't necessarily double the size of your app unless you're putting .tmp under version control, but if you have a lot of assets it can certainly make your app slow to start.
The simplest solution here is to turn off Grunt and serve your static assets directly from the assets folder. To do that:
Create a new config file called config/assets.js (or whatever you like; the name doesn't matter), and put the following inside:
module.exports = {
paths: {
public: __dirname+"/../assets"
}
};
The reason to put this in a new config file rather than config/local.js is that local.js is in your .gitignore file by default, so if you're using Git for version control you'd have to recreate that file every time you install the app on a new machine.
Like I said, this is the simplest solution, but it has some drawbacks:
If you want to keep those features, but still avoid copying lots of files into .tmp, then the answer lies in modifying the default Grunt tasks (that's what they're in your project for!).
Upvotes: 8