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

allInOne 接收对象配置项 文件名问题 #25

Open
callect opened this issue Oct 16, 2015 · 6 comments
Open

allInOne 接收对象配置项 文件名问题 #25

callect opened this issue Oct 16, 2015 · 6 comments

Comments

@callect
Copy link

callect commented Oct 16, 2015

默认配置路径是按${filepath}输出出来,我只想输出文件名怎么办?试过好多都不行

@codering
Copy link

是这个吗?
allInOne: {
css: "pkg/aio.css",
js: "pkg/aio.js"
},

@small-joker
Copy link

同问,如何修改这个名字或者与原js文件名相同也可以

@2betop
Copy link
Contributor

2betop commented Jan 13, 2016

目前只有这两个变量可以用。https://github.com/fex-team/fis3-postpackager-loader/blob/master/lib/pack.js#L105-L108

把你可能需要的数据在这说下吧。下次我就加上去。

@small-joker
Copy link

有些情况是这样的,当多个页面中共用一个页面js文件pageCommon.js的时候。而像现在这样只能生成多个重复的js文件(page1.js, page2.js, page3.js....),尽管page1,page2等完全相同。
希望能有一个参数记录页面的js文件的名称的,比如叫fileName,这样我就能
allInOne: {
js: "pkg/$(fileName).js"
},来控制合并后的文件名字了。

@2betop
Copy link
Contributor

2betop commented Jan 13, 2016

fileName 可以加。

你想用 allInOne 来实现共用部分的打包?

推荐用https://github.com/fex-team/fis3-packager-map 或者 https://github.com/fex-team/fis3-packager-deps-pack 的方式配置打包, 把共用的部分通过手动的方式配置好。两者可以结合。packager 中打包剩下的会在 loader 中 allInOne.

@small-joker
Copy link

谢谢,
我的意思是:比如有两个页面page1,page2,按原来这种做法应该是page1.js, page2.js,但当两个页面中的前端代码一样的时候,其实只要page1,page2页面都引入page1.js文件就可能了,page2.js就没有必要存在了,
如:

<script src="../static/sea.js"></script> <script>seajs.use("page1.js");</script>

当一个项目比较大的时候可能会有多个页面前端代码一致,有利于缓存的使用

另一个目的,也是主要的目的就为了把页面js文件的命名能与页面命名分开。

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

4 participants