From 80b7ab233738dd7f0a7bb5d5bbf1456178d3d003 Mon Sep 17 00:00:00 2001 From: bokovgleb Date: Mon, 8 Apr 2019 10:47:50 +0900 Subject: [PATCH] Clear for first checking --- types/gulp-postcss/gulp-postcss-test.ts | 43 +++++++++++++++++++++++++ types/gulp-postcss/index.d.ts | 19 +++++++++++ types/gulp-postcss/tsconfig.json | 23 +++++++++++++ types/gulp-postcss/tslint.json | 3 ++ 4 files changed, 88 insertions(+) create mode 100644 types/gulp-postcss/gulp-postcss-test.ts create mode 100644 types/gulp-postcss/index.d.ts create mode 100644 types/gulp-postcss/tsconfig.json create mode 100644 types/gulp-postcss/tslint.json diff --git a/types/gulp-postcss/gulp-postcss-test.ts b/types/gulp-postcss/gulp-postcss-test.ts new file mode 100644 index 0000000000..9fe2284389 --- /dev/null +++ b/types/gulp-postcss/gulp-postcss-test.ts @@ -0,0 +1,43 @@ +import * as gulp from 'gulp'; +import * as postcss from 'gulp-postcss'; +import * as autoprefixer from 'autoprefixer'; +import * as Vinyl from 'vinyl' + +gulp.task('postCss1', () => { + return gulp.src('./src/*.css') + .pipe(postcss()) + .pipe(gulp.dest('./dest')); +}); + +gulp.task('postCss2', () => { + const postCssPlugins = [ autoprefixer({browsers: ['last 1 version']}) ]; + return gulp.src('./src/*.css') + .pipe(postcss(postCssPlugins)) + .pipe(gulp.dest('./dest')); +}); + +/* +gulp.task('postCss3', () => { + const plugins = [ autoprefixer({browsers: ['last 1 version']}) ]; + return gulp.src('in.sss') + .pipe(postcss(plugins, { parser: sugarss })) + .pipe(gulp.dest('out')); +}); +*/ + +gulp.task('postCss4', () => { + function callback(file: Vinyl) { + return { + plugins: [ + require('postcss-import')({ root: file.dirname }), + require('postcss-modules') + ], + options: { + parser: file.extname === '.sss' ? require('sugarss') : false + } + }; + } + return gulp.src('./src/*.css') + .pipe(postcss(callback)) + .pipe(gulp.dest('./dest')); +}); diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts new file mode 100644 index 0000000000..98e3d9310d --- /dev/null +++ b/types/gulp-postcss/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for gulp-postcss 8.0 +// Project: https://www.npmjs.com/package/gulp-postcss +// Definitions by: Takesi Tokugawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import Vinyl = require('vinyl'); + +declare function GulpPostCss(plugins?: string[], options?: GulpPostCss.Options): NodeJS.ReadWriteStream; +declare function GulpPostCss(callback?: (file: Vinyl) => { plugins?: string[], options?: GulpPostCss.Options }): + NodeJS.ReadWriteStream; + +declare namespace GulpPostCss { + interface Options { + parser?: Object; + } +} + +export = GulpPostCss; diff --git a/types/gulp-postcss/tsconfig.json b/types/gulp-postcss/tsconfig.json new file mode 100644 index 0000000000..d48ac90475 --- /dev/null +++ b/types/gulp-postcss/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-tap-tests.ts" + ] +} diff --git a/types/gulp-postcss/tslint.json b/types/gulp-postcss/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/gulp-postcss/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}