I have followed the instructions here yet I couldn't get the linker to work with Jade. If, however I use ejs instead, it does work (exactly the same app, apart from the jade/ejs files of course). Am I missing something?
Sails is built on Node. js, a popular, lightweight server-side technology that allows developers to write blazing fast, scalable network appliations in JavaScript. Sails uses Express for handling HTTP requests, and wraps socket.io for managing WebSockets.
Sails is the most popular MVC framework for Node. js, designed to emulate the familiar MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps: data-driven APIs with a scalable, service-oriented architecture.
js (or Sails) is a model–view–controller (MVC) web application framework developed atop the Node. js environment, released as free and open-source software under the MIT License. It is designed to make it easy to build custom, enterprise-grade Node. js web applications and APIs.
I'm assuming you have done the following:
Created a new project with linker and jade as template
sails new <project-name> --template=jade --linker
you manually added jade
cd <project-name>
npm install jade --save
(optionally) removed the dependency to ejb in the package.json file.
Is that correct?
In that case, I've received a warn that says:
warn: Automatic asset linking is not implemented for the `jade` view engine at this time. You must modify the Gruntfile yourself for this feature to work.
This looks like an old and outdated message, as I looked to the grunt file and everything look like it was prepared for linking to jade.
So then, I've changed the layout.jade file in the views folder to:
and add the placeholders to inject:
// SCRIPTS
// SCRIPTS END
// STYLES
// STYLES END
Then I made a "sails lift" and the scripts in the javascript files in the public/linker/js folder were injected.
BTW: I'm using sails v0.9.9
Hope this helps.
Being new to sails and jade i found the following link helpful. Turns out you need to go into config > views.js & then change the "engine:" from saying 'ejs' to 'jade'
After doing this you'll have to also install jade as a dependency:
npm install jade --save
sails can't find layout.jade
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With