mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Type definitions for sass-webpack-plugin 1.0.0 (#23898)
* finish * add tslint * pass lint * fix some error * fix export error
This commit is contained in:
32
types/sass-webpack-plugin/index.d.ts
vendored
Normal file
32
types/sass-webpack-plugin/index.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Type definitions for sass-webpack-plugin 1.0
|
||||
// Project: https://github.com/jalkoby/sass-webpack-plugin
|
||||
// Definitions by: AEPKILL <https://github.com/AepKill>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { Options } from 'node-sass';
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare namespace SassPlugin {
|
||||
type NODE_ENV = 'production' | 'development';
|
||||
type FileRule = string | string[] | { [key: string]: string };
|
||||
interface Config {
|
||||
sourceMap?: boolean;
|
||||
autoprefixer?: boolean;
|
||||
sass?: Options;
|
||||
}
|
||||
}
|
||||
|
||||
declare class SassPlugin extends Plugin {
|
||||
constructor(
|
||||
file: SassPlugin.FileRule,
|
||||
mode?: SassPlugin.NODE_ENV | SassPlugin.Config
|
||||
);
|
||||
constructor(
|
||||
file: SassPlugin.FileRule,
|
||||
mode: SassPlugin.NODE_ENV,
|
||||
config?: SassPlugin.Config
|
||||
);
|
||||
}
|
||||
|
||||
export = SassPlugin;
|
||||
30
types/sass-webpack-plugin/sass-webpack-plugin-tests.ts
Normal file
30
types/sass-webpack-plugin/sass-webpack-plugin-tests.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import SassPlugin = require('sass-webpack-plugin');
|
||||
|
||||
type NODE_ENV = SassPlugin.NODE_ENV;
|
||||
|
||||
const env = process.env.NODE_ENV as NODE_ENV;
|
||||
|
||||
new SassPlugin('./src/styles/index.scss');
|
||||
|
||||
// production ready
|
||||
new SassPlugin('./src/styles/index.scss', env);
|
||||
|
||||
// multi files
|
||||
new SassPlugin(['./src/styles/one.scss', './src/styles/two.sass'], env);
|
||||
|
||||
// a different output filename
|
||||
new SassPlugin({ './src/styles/index.scss': 'bundle.css' }, env);
|
||||
|
||||
// with sass tuning
|
||||
new SassPlugin('./src/styles/index.scss', env, {
|
||||
sass: {
|
||||
includePaths: ['node_modules/bootstrap-sass/assets/stylesheets']
|
||||
}
|
||||
});
|
||||
|
||||
// with source maps + compressing - autoprefixing
|
||||
new SassPlugin('./src/styles/index.scss', {
|
||||
sourceMap: true,
|
||||
sass: { outputStyle: 'compressed' },
|
||||
autoprefixer: false
|
||||
});
|
||||
17
types/sass-webpack-plugin/tsconfig.json
Normal file
17
types/sass-webpack-plugin/tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "sass-webpack-plugin-tests.ts"]
|
||||
}
|
||||
1
types/sass-webpack-plugin/tslint.json
Normal file
1
types/sass-webpack-plugin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user