当我安装css插件时,使用以下命令:
jspm install css
我的config.js中添加了以下内容:
System.config({
"map": {
"css": "github:systemjs/plugin-css@0.1.6",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-buffer@0.1.0": {
"buffer": "npm:buffer@3.0.3"
},
"github:jspm/nodelibs-events@0.1.0": {
"events-browserify": "npm:events-browserify@0.0.1"
},
"github:jspm/nodelibs-http@1.7.0": {
"Base64": "npm:Base64@0.2.1",
"events": "github:jspm/nodelibs-events@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"github:jspm/nodelibs-https@0.1.0": {
"https-browserify": "npm:https-browserify@0.0.0"
},
"github:jspm/nodelibs-os@0.1.0": {
"os-browserify": "npm:os-browserify@0.1.2"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.1": {
"process": "npm:process@0.10.1"
},
"github:jspm/nodelibs-stream@0.1.0": {
"stream-browserify": "npm:stream-browserify@1.0.0"
},
"github:jspm/nodelibs-url@0.1.0": {
"url": "npm:url@0.10.3"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"github:systemjs/plugin-css@0.1.6": {
"clean-css": "npm:clean-css@3.0.10",
"fs": "github:jspm/nodelibs-fs@0.1.1",
"path": "github:jspm/nodelibs-path@0.1.0"
},
"npm:amdefine@0.1.0": {
"fs": "github:jspm/nodelibs-fs@0.1.1",
"module": "github:jspm/nodelibs-module@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:buffer@3.0.3": {
"base64-js": "npm:base64-js@0.0.8",
"ieee754": "npm:ieee754@1.1.4",
"is-array": "npm:is-array@1.0.1"
},
"npm:clean-css@3.0.10": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"commander": "npm:commander@2.5.1",
"fs": "github:jspm/nodelibs-fs@0.1.1",
"http": "github:jspm/nodelibs-http@1.7.0",
"https": "github:jspm/nodelibs-https@0.1.0",
"os": "github:jspm/nodelibs-os@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1",
"source-map": "npm:source-map@0.1.43",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:commander@2.5.1": {
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"events": "github:jspm/nodelibs-events@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:core-util-is@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:events-browserify@0.0.1": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:https-browserify@0.0.0": {
"http": "github:jspm/nodelibs-http@1.7.0"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:os-browserify@0.1.2": {
"os": "github:jspm/nodelibs-os@0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:punycode@1.3.2": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:readable-stream@1.1.13": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"core-util-is": "npm:core-util-is@1.0.1",
"events": "github:jspm/nodelibs-events@0.1.0",
"inherits": "npm:inherits@2.0.1",
"isarray": "npm:isarray@0.0.1",
"process": "github:jspm/nodelibs-process@0.1.1",
"stream": "npm:stream-browserify@1.0.0",
"string_decoder": "npm:string_decoder@0.10.31",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:source-map@0.1.43": {
"amdefine": "npm:amdefine@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.1",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:stream-browserify@1.0.0": {
"events": "github:jspm/nodelibs-events@0.1.0",
"inherits": "npm:inherits@2.0.1",
"readable-stream": "npm:readable-stream@1.1.13"
},
"npm:string_decoder@0.10.31": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:url@0.10.3": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"punycode": "npm:punycode@1.3.2",
"querystring": "npm:querystring@0.2.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.1"
}
}
});
如何保持我的config.js整洁,以避免在我的所有页面中包含所有这些信息(因为config.js需要包含在每个页面中)?
答案 0 :(得分:7)
我也是JSPM的新手,对大config.js
尺寸也有类似的反应,但这里有一些我学到的东西:
1)我不会将JSPM用于您只想在服务器端/开发机器上使用的Node模块。您可以继续使用NPM。我犯了这个错误 - 认为我应该将JSPM用于所有依赖项,取代Bower和NPM。我通过JSPM安装了gulp
,我的config.js突然超过700行!
2)我想知道是否可以将其配置为仅记录顶级依赖项 - 比如在package.json中 - 并非所有依赖项的依赖项......它听起来不像它。我在Gitter group中询问并且响应是:“大不了,它让你可以控制你在npm中没有的对等依赖”。 (谢谢Mitranim)。
3)如果你熟悉require.js,你可以认为你的config.js有点像你的require.config(...)
。它所做的一件事就是设置你可以用来包含模块的短名称。作为一个以前的require.js用户,我接受了我需要在前端包含我的require.js配置文件作为入口点,并且对于config.js也是如此 - 至少,对于开发...
4)生产是另一回事。引用Guy Bedford on the Gitter group:“配置文件并不意味着包含在生产\工作流程中,将会开发”。 “入门指南”中的"Bundle for production" section中提供了更多信息。
5)我发现一个有用的起点是Jack Franklin的demo from Async Brighton。特别值得注意的是:他有一个用于生产的捆绑工作流程,它将脚本包括切换为仅指向缩小的app.min.js
- 请参阅Makefile。