Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前端模板tpl引入widget的时候直接把widget中的require作为字符串处理了 #663

Open
leaven opened this issue Sep 17, 2015 · 2 comments

Comments

@leaven
Copy link

leaven commented Sep 17, 2015

我现在有个模块 比如module(s_loading.html, s_loading.css)

    <!-- 
        @useage use fis import html
        @require "s_loading.less"
     -->
    <div class="s-loading">

    </div>

现在在一个模板文件里面(tpl)用link import方式引入s_loading.html

    <div id="i_recommend">
        <link rel="import" href="/common/widget/s_loading/s_loading.html?__inline">
    </div>

然后我在index.js中用inline 引入这个tpl append到页面中,这个时候,require "s_loading.less"其实是作为一个字符串处理的,并没有真正把s_loading.less加载进来,想问下这种情况怎么处理?

@MicroConan
Copy link

正确使用姿势应该是:
模块s_loading里增加一个s_loading.js
index.js require s_loading.js
s_loading.js require s_loading.css
s_loading.js inline s_loading.html

@leaven
Copy link
Author

leaven commented Sep 19, 2015

s_loading作为一个模板组件存在,并不是js组件,而且s_loading希望首次加载直接render到页面,而不是异步运行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants