src/index.js
function vuePack(file, encoding, callback) {
    if (!file) {
        throw new PluginError('gulp-vue-pack', 'file不存在');
    }

    if (file.isStream()) {
        throw new PluginError('gulp-vue-pack', '只支持.vue文件');
    }

    if (!file.contents) {
        //非文件,是目录
        callback();
        return;
    }

    let fileName = path.basename(file.path, ".vue");

    let fileContent = file.contents.toString(encoding);

    let contents = parseVueToContents(fileContent, fileName, path.dirname(file.path));
    let fpath = path.dirname(file.path);

    this.push(createFile(file.base, file.cwd, fpath, fileName + ".js", contents.js));

    //如果css文件无内容，则不生成css文件
    if(contents.css.length > 0) {
        this.push(createFile(file.base, file.cwd, fpath, fileName + ".css", contents.css));
    }
    callback();

}
function vuePack(file, encoding, callback) {
    if (!file) {
        throw new PluginError('gulp-vue-pack', 'file不存在');
    }

    if (file.isStream()) {
        throw new PluginError('gulp-vue-pack', '只支持.vue文件');
    }

    if (!file.contents) {
        //非文件,是目录
        callback();
        return;
    }

    let fileName = path.basename(file.path, ".vue");

    let fileContent = file.contents.toString(encoding);

    let contents = parseVueToContents(fileContent, fileName, path.dirname(file.path));
    let fpath = path.dirname(file.path);

    this.push(createFile(file.base, file.cwd, fpath, fileName + ".js", contents.js));

    //如果css文件无内容，则不生成css文件
    if(contents.css.length > 0) {
        this.push(createFile(file.base, file.cwd, fpath, fileName + ".css", contents.css));
    }
    callback();

}
打包组件成js和css文件
@param file
@param encoding
@param callback