选择资产sailsjs [英] choosing assets sailsjs

查看:83
本文介绍了选择资产sailsjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始将SailsJS用于小型网络应用程序,到目前为止它非常棒。
但是我在资产和布局上苦苦挣扎。

I've started using SailsJS for a small web app and so far it's great. However I'm struggling with the assets and layout.

基本上我希望能够使用不同类型的资产(css文件组),具体取决于在页面上。
为此,我写了两个不同的布局,每个布局都应该包含正确的css文件。
但是,当我在 config / assets.js 文件中添加这些文件时,所有文件都捆绑在一起。
有没有办法在我的布局中指定我想要使用哪些资产?
我知道你可以指定 assets.js assets.styles 但我希望能够创建我自己的小组。

Basically I would like to be able to use different type of assets (groups of css files) depending on the page. For this, I wrote 2 different layouts, each should includes the correct css files. However, when I add those files in the config/assets.js files there all bundled together. Is there a way to specifiy in my layout which assets i want to use ? I know you can specify assets.js or assets.styles but I would like to be able to create my own group .

我还尝试将这些资产放在不同的目录(例如public)中,并在我的布局中手动加载它们。它仍然无法正常工作,因为服务器不想服务它们。

I also tried to put those assets in a different directory (public for example) and load them manually in my layout. It's still not working because the server doesn't want to 'serve' them.

任何想法?

推荐答案

很高兴你喜欢Sails:)

Glad you're liking Sails :)

现在,您可以(a)随时携带所有款式并制作只有相关的应用(b)使用其他工具(如Grunt)捆绑资产,就像在vanilla node.js项目中捆绑资产一样,或者(c)手动链接样式表(将它们放在公共文件夹中)。

For now, you can (a) bring in all styles all the time and make only the relevant ones apply (b) use another tool (like Grunt) to bundle assets like you would in a vanilla node.js project or (c) link the stylesheets manually (put them in your public folder).

至于路线图 - 社区正在研究更多用于提供模板/样式/客户端逻辑的选项。这里有一个开放的规范:

As for the roadmap-- the community is working on more options for serving templates/styles/client-side logic. There's an open spec here:

https://github.com / balderdashy / sails / issues / 240

希望有所帮助!

这篇关于选择资产sailsjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆