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

不同task的配置共享? #7

Open
akecn opened this issue Nov 2, 2013 · 0 comments
Open

不同task的配置共享? #7

akecn opened this issue Nov 2, 2013 · 0 comments

Comments

@akecn
Copy link

akecn commented Nov 2, 2013

目录

common/
    - testcom.js
test/
    - init.js
    - index.js
    - index.css
    - gruntfile.js

KMC配置

kmc: {
    main:{
        options: {
            packages: [
                {
                    name: 'common',
                    path: '../',
                    charset: 'utf-8'
                },
                {
                    name: 'test',
                    path: '../',
                    charset: 'utf-8'
                }
            ],
            depFilePath:'deps.js',
            comboOnly: true
        },
        files: [
            {
                src: './init.js'
            }
        ]
    },
    page:{
        options: {
            packages: [
                {
                    name: 'test',
                    path: '../',
                    charset: 'utf-8'
                }
            ]
        },
        files: [
            {
                src: './init.js',
                dest: "./init.combo.js"
            }
        ]
    }
}

init.js代码

KISSY.add(function() {

}, {
    requires: ['./index', './index.css']
})

index.js内容

KISSY.add(function(S, D, E, IO) {

}, {
    requires: ['dom', 'event', 'ajax', 'common/testcom']
})

输出的结果:
deps.js内容

KISSY.config('modules', {
 'test/init': { requires: ['test/index']},
 'test/index': { requires: ['dom', 'event', 'ajax', 'common/testcom']} 
});

init.combo.js内容

/*
combined files : 
common/testcom
test/index
test/init
*/
KISSY.add('common/testcom',function() {
    // testcom.js
});
KISSY.add('test/index',function(S, D, E, IO) {

}, {
    requires: ['dom', 'event', 'ajax', 'common/testcom']
})
KISSY.add('test/init',function() {

}, {
    requires: ['./index']
})

期望结果

index.combo.js中不要将common的文件内容打包进来。

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

1 participant