Comparing version 1.18.2 to 1.18.3
@@ -0,1 +1,6 @@ | ||
## <small>1.18.3 (2019-10-26)</small> | ||
* docs: update readme ([2911650](https://github.com/danhuang1202/react2amp/commit/2911650)) | ||
* fix: cache css ([04a49a0](https://github.com/danhuang1202/react2amp/commit/04a49a0)) | ||
## <small>1.18.2 (2019-10-26)</small> | ||
@@ -2,0 +7,0 @@ |
@@ -249,2 +249,3 @@ 'use strict'; | ||
this.ampComponentMap = {}; | ||
this.cssMap = {}; | ||
} | ||
@@ -259,2 +260,3 @@ | ||
_this.ampComponentMap = {}; | ||
_this.cssMap = {}; | ||
var result = {}; | ||
@@ -499,2 +501,3 @@ var javascriptRegex = /\.(js|mjs)(\?|$)/; | ||
var result = ''; | ||
var _iteratorNormalCompletion4 = true; | ||
@@ -514,3 +517,12 @@ var _didIteratorError4 = false; | ||
css += module.content.replace(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//g, '').replace(/\r?\n/g, ''); | ||
var context = module.context, | ||
content = module.content; | ||
if (this.cssMap[context]) { | ||
result += this.cssMap[context]; | ||
} else { | ||
var newCss = content.replace(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//g, '').replace(/\r?\n/g, ''); | ||
this.cssMap[context] = newCss; | ||
result += newCss; | ||
} | ||
} | ||
@@ -532,3 +544,3 @@ } catch (err) { | ||
return css; | ||
return css + result; | ||
} | ||
@@ -535,0 +547,0 @@ }]); |
{ | ||
"name": "react2amp", | ||
"version": "1.18.2", | ||
"version": "1.18.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -106,3 +106,4 @@ # react2amp | ||
| includeEntries | string[] | false | [] | Only collect assets from the entries inside `includeEntries` | | ||
| excludeResourcesRegExp | RegExp | false | - | Ignore the module resources match the `excludeResourcesRegExp` rules | | ||
| excludeJsResourcesRegExp | RegExp | false | - | Ignore the module resources match the `excludeJsResourcesRegExp` rules when finding AMP components | | ||
| excludeCssResourcesRegExp | RegExp | false | - | Ignore the module resources match the `excludeCssResourcesRegExp` rules when finding css | | ||
@@ -109,0 +110,0 @@ usage: |
@@ -22,2 +22,3 @@ declare type FileName = string; | ||
private ampComponentMap; | ||
private cssMap; | ||
constructor(options: Options); | ||
@@ -24,0 +25,0 @@ apply(compiler: any): void; |
58691
1056
367