Skip to content

Commit

Permalink
Merge 984b038 into e8bb713
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Aug 26, 2019
2 parents e8bb713 + 984b038 commit 0841e40
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ export default {
* Type: `boolean`
* Default: `false`

#### injectCSS

是否在 <head>里注入css, 如果`extractCSS: true`,则为`false`

* Type: `boolean`
* Default: `true`

#### extraBabelPresets

配置额外的 babel preset。
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

export default {
injectCSS: false,
esm: { type: 'rollup' },
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var css = "\n.a { color: green; }\n";

console.log(css);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.a { color: green; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import style from './foo.css';

console.log(style);
2 changes: 2 additions & 0 deletions packages/father-build/src/getRollupConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function(opts: IGetRollupConfigOpts): RollupOptions[] {
file,
target = 'browser',
extractCSS = false,
injectCSS = true,
cssModules: modules,
extraPostCSSPlugins = [],
extraBabelPresets = [],
Expand Down Expand Up @@ -128,6 +129,7 @@ export default function(opts: IGetRollupConfigOpts): RollupOptions[] {
svgr(),
postcss({
extract: extractCSS,
inject: injectCSS,
modules,
use: [
[
Expand Down
3 changes: 3 additions & 0 deletions packages/father-build/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export default {
extractCSS: {
type: 'boolean',
},
injectCSS: {
type: 'boolean',
},
autoprefixer: {
type: 'object',
},
Expand Down
1 change: 1 addition & 0 deletions packages/father-build/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface IBundleOptions {
extraExternals?: string[];
cssModules?: boolean | Object;
extractCSS?: boolean;
injectCSS?: boolean,
autoprefixer?: Object;
namedExports?: IStringArrayObject;
runtimeHelpers?: boolean;
Expand Down

0 comments on commit 0841e40

Please sign in to comment.