We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
先看看官方文档的例子
define("main", function(require) { //此模块的 factory 函数能够被执行 // You can require `.tpl` file directly var tpl = require("./data.tpl") });
嗯,这样子是可以正常加载模板的。那再试试下面的写法
define("main",[], function(require) { //此模块的 factory 函数能够被执行 // You can require `.tpl` file directly var tpl = require("./data.tpl") });
区别不大,只是加了个空的依赖数组,模板加载就失效了,始终都会执行到seajs-css上;
seajs-css
seajs-text
// for css
register({ name: "css",
ext: [".css"],
exec: function(uri, content) { var code = [ 'define("' + uri + '#", ["importstyle"], function(require, exports, module) {', ' var source = "' + jsEscape(content) + '"', ' var importStyle = require("importstyle")', ' module.exports = function() {', ' importStyle(source, "' + uri + '#")', ' }', '})' ].join('\n')
globalEval(code)
} })
对的,看到`importstyle`,它是 `seajs-style`插件的方法。你得自己在配置中加上`alias` 那问题是什么呢? 当你和 `seajs-css`插件一起使用的时候,就无法使用`link`方式加载样式了,只能摘取到样式字符串文本。 解决方法呢,把以上代码去掉就好了。 > 是不是这样子呢。
The text was updated successfully, but these errors were encountered:
请用 seajs-text 的稳定版,不要用 master 上的开发版。
Sorry, something went wrong.
define("main",[], function(require) { //此模块的 factory 函数能够被执行 // You can require .tpl file directly var tpl = require("./data.tpl")
.tpl
});
这样写,加载模板就失效了!但是:
define("main", function(require) { //此模块的 factory 函数能够被执行 // You can require .tpl file directly var tpl = require("./data.tpl") }); 这样写,就能加载模板
No branches or pull requests
1、加载模板问题
先看看官方文档的例子
嗯,这样子是可以正常加载模板的。那再试试下面的写法
区别不大,只是加了个空的依赖数组,模板加载就失效了,始终都会执行到
seajs-css
上;2、加载样式问题
// for css
register({
name: "css",
ext: [".css"],
exec: function(uri, content) {
var code = [
'define("' + uri + '#", ["importstyle"], function(require, exports, module) {',
' var source = "' + jsEscape(content) + '"',
' var importStyle = require("importstyle")',
' module.exports = function() {',
' importStyle(source, "' + uri + '#")',
' }',
'})'
].join('\n')
}
})
The text was updated successfully, but these errors were encountered: