SailsJS:需要资产,比如sails.io.js [英] SailsJS: Requiring Assets, Such As, sails.io.js

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

问题描述

由于问题很简短& sweet,我会保留这个问题。



无法加载资产。



使用Sails.js ( v0.11.n )。



无法加载资产...就是这样...



我试图加载 sails.io.js - 或者现在甚至只是 assets / alert.js



< script type =text / javascriptsrc =/ js /dependencies/sails.io.js\"></script> 无效:(



即使我将 src 切换为 /alert.js - 什么都没有。



我在 / signup 视图中粘贴了这个脚本标签 - 可以正常加载 - 但我知道我确实做得很好 c $ c> app generator has been fixed。问题在于,对于任何新的应用程序,Grunt钩子都将被禁用,这样您的资产就不会自动复制到您的应用程序的 .tmp / public 文件夹在电梯时间。只有在 - no-front-end 选项与 sails new 一起使用时,才会出现这种情况,但它一直在发生着。您可以通过查看应用程序的 .sailsrc 文件来检查此问题;如果您看到:

$ $ p $ 钩子:{
grunt:false
}

删除它,您的资产将再次可用。


As the problem is short & sweet, I'll keep the question so.

CAN'T LOAD ASSETS.

Using Sails.js (v0.11.n).

Can't load assets... That's about it...

I'm trying to load sails.io.js -- or now even just assets/alert.js.

<script type="text/javascript" src="/js/dependencies/sails.io.js"></script> Doesn't work :(

Even when I switch the src to /alert.js -- nothing.

I'm pasting this script tag inside of my /signup view -- which loads fine -- but I know sure as heck I'm doing something(s) wrong.

解决方案

This was due to an issue with the sails new app generator that has been fixed. The issue was that for any new app, the Grunt hook would be disabled, so that your assets would not be copied automatically into your app's .tmp/public folder at lift time. This is only supposed to happen if the --no-front-end option is used with sails new, but it was happening all the time. You can check for this problem by looking in your app's .sailsrc file; if you see:

"hooks": {
   "grunt": false
}

remove it, and your assets will be accessible again.

这篇关于SailsJS:需要资产,比如sails.io.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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