當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript gulp4.src函數代碼示例

本文整理匯總了TypeScript中gulp4.src函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript src函數的具體用法?TypeScript src怎麽用?TypeScript src使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了src函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: Revision

export default function Revision() {
    let settings = helper.getSettings();
    if (!helper.isRelease()) return Promise.resolve();
    if (settings.revisionExclude === "*") {
        return gulp.src(helper.getTempFolder() + '/**')
            .pipe(gulp.dest(helper.getDistFolder()));
    }
    let excludedFiles = _.union(
        ['favicon.ico', 'index.html'],
        _.map(settings.revisionExclude, (rule: any) => rule.regexp ? new RegExp(rule.pattern) : rule.pattern));
    return gulp.src(helper.getTempFolder() + '/**')
        .pipe(RevAll.revision({
            dontRenameFile: excludedFiles,
            dontUpdateReference: excludedFiles,
            dontSearchFile: [/.*\.pdf/]
        }))
        .pipe(gulp.dest(helper.getDistFolder()));
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:18,代碼來源:Revision.ts

示例2: Scaffolding

export default function Scaffolding() {
    let name = helper.getCurrentTarget();
    if (!name) {
        return Promise.reject(new Error("Missing required project name"));
    }
    let projectPath = path.resolve(__dirname, "../../scaffolding", helper.getProjectType());
    return gulp.src(projectPath + '/**/*')
        .pipe(replace("$$NAME", name))
        .pipe(gulp.dest(`./${name}`));
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:10,代碼來源:Scaffolding.ts

示例3: Typescript

export default function Typescript() {
    let settings = helper.getSettings(),
        tsProject = ts.createProject("tsconfig.json", {typescript: require(settings.typescriptPath)});

    return gulp.src(settings.scripts)
        .pipe(tsProject())
        .on("error", function (error) {
            if (!helper.isWatching())
                process.exit(1);
        })
        .pipe(gulp.dest(settings.distribution));
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:12,代碼來源:Typescript.ts

示例4: Test

export default function Test() {
    return gulp.src(helper.getSettings().test, {read: false})
        .pipe(mocha({
            reporter: 'spec',
            compilers: {
                ts: require('ts-node').register({
                    compiler: helper.getSettings().typescriptPath
                })
            }
        }))
        .once('end', function () {
            process.exit();
        })
        .on("error", (error) => {
            console.error(Util.formatError(error));
            process.exit(1)
        });
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:18,代碼來源:Test.ts

示例5: Styles

export default function Styles() {
    let settings = helper.getSettings();
    let bootstrapperBasePath = (settings.bootstrapperStyles) ? settings.bootstrapperStyles :
        path.resolve(process.cwd(), settings.targets, helper.getCurrentTarget());

    let bootstrapperPath = path.resolve(bootstrapperBasePath, 'bootstrapper.scss');
    if (!fs.existsSync(bootstrapperPath)) {
        console.warn("Styles bootstrapper not found at path", bootstrapperPath, ", skipping styles build process.");
        return Promise.resolve();
    }

    let stream = gulp.src(bootstrapperPath);

    function bundleRelease(stream) {
        return stream
            .pipe(concat('main.css'))
            .pipe(applySass())
            .pipe(autoprefixer({browsers: settings.autoprefixer}))
            .pipe(minify())
            .pipe(gulp.dest(helper.getTempFolder() + '/css'));
    }

    function bundleDevelopment(stream) {
        return stream
            .pipe(sourcemaps.init())
            .pipe(concat('main.css'))
            .pipe(applySass())
            .pipe(autoprefixer({browsers: settings.autoprefixerRules}))
            .pipe(sourcemaps.write())
            .pipe(gulp.dest(helper.getDistFolder() + '/css'))
            .pipe(refresh({
                start: helper.isWatching(),
                port: settings.liveReloadPort
            }));
    }

    function applySass() {
        return sass({
            importer: moduleImporter({basedir: process.cwd()})
        }).on('error', sass.logError)
    }

    return helper.isRelease() ? bundleRelease(stream) : bundleDevelopment(stream);
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:44,代碼來源:Styles.ts

示例6: Images

export default function Images() {
    let settings = helper.getSettings();
    return gulp.src(settings.images + '/**/*')
        .pipe(gulp.dest(path.join(helper.getTempFolder(), settings.images)));
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:5,代碼來源:Images.ts

示例7: CopyIndex

export default function CopyIndex() {
    let stream = gulp.src('index.html');
    if (helper.isWatching())
        stream = stream.pipe(embedlr({ port: helper.getSettings().liveReloadPort}));
    return stream.pipe(gulp.dest(helper.getTempFolder()));
}
開發者ID:mtfranchetto,項目名稱:smild,代碼行數:6,代碼來源:CopyIndex.ts


注:本文中的gulp4.src函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。