Skip to content

Commit

Permalink
perf: using calc() for division in sass. close #850
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeLin committed Dec 27, 2021
1 parent 7fa10c5 commit a8b3a43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/zarm/src/activity-indicator/style/component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $activity-indicator-spinner-count : 12;

&:nth-of-type(#{$i}) {
transform: rotate($i * 30deg);
opacity: 1 - (0.75 / $activity-indicator-spinner-count) * ($i - 1);
opacity: 1 - calc(0.75 / $activity-indicator-spinner-count * ($i - 1));
}

&::before {
Expand Down

2 comments on commit a8b3a43

@zxc6881553
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的这个更改会导致打包报错。

JisonLexerError: Lexical error on line 1: Unrecognized text.

Erroneous area:
1: 0.75 / $activity-indicator-spinner-count * ($i - 1)
^.........^
at /wwwroot/umi.e6377a7f.css:1651:3
at Object.parseError (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1060336)
at Object.lexer_parseError [as parseError] (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1067523)
at Object.lexer_next [as next] (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1077684)
at Object.lexer_fastLex [as fastLex] (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1078466)
at fastLex (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1063127)
at Parser.parse (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1063649)
at /wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1053275
at walk (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1142146)
at ValueParser.walk (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1137452)
at transformValue (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1053157)
at _default (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1053730)
at callback (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1046407)
at callback (/wwwroot/node_modules/postcss/lib/container.es6:110:18)
at Rule.each (/wwwroot/node_modules/postcss/lib/container.es6:76:16)
at Rule.walk (/wwwroot/node_modules/postcss/lib/container.es6:107:17)
at /wwwroot/node_modules/postcss/lib/container.es6:121:24 {
hash: {
errStr: 'Lexical error on line 1: Unrecognized text.\n' +
'\n' +
' Erroneous area:\n' +
'1: 0.75 / $activity-indicator-spinner-count * ($i - 1)\n' +
'^.........^',
recoverable: false,
text: '',
token: null,
line: 0,
loc: {
first_line: 1,
first_column: 7,
last_line: 1,
last_column: 7,
range: [Array]
},
yy: {
parseError: undefined,
quoteName: undefined,
lexer: undefined,
parser: undefined,
pre_parse: undefined,
post_parse: undefined,
pre_lex: undefined,
post_lex: undefined
},
lexer: {
yy: {},
__decompressed: true,
_input: '',
yytext: '',
yyleng: 0,
match: '',
matches: false,
_more: false,
_backtrack: false,
yylloc: [Object],
_signaled_error_token: false,
done: false,
yylineno: 0,
matched: '',
conditionStack: [Array],
currentRuleSet: null,
offset: 0
},
destroy: [Function: destructLexErrorInfo]
},
postcssNode: Declaration {
raws: { before: '\n ', between: ':' },
type: 'decl',
parent: Rule {
raws: [Object],
type: 'rule',
nodes: [Array],
parent: [Root],
source: [Object],
selector: '.za-activity-indicator--spinner div:nth-of-type(1)',
lastEach: 9,
indexes: [Object]
},
source: { start: [Object], input: [Input], end: [Object] },
prop: 'opacity',
value: '1-calc(0.75 / $activity-indicator-spinner-count * ($i - 1))'
}
}
build failed
Error: build failed
at /wwwroot/node_modules/@umijs/bundler-webpack/lib/index.js:172:29
at finalCallback (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108196:12)
at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108217:14
at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:67111:7
at done (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:67206:13)
at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108128:23
at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108209:15
at finalCallback (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98589:39)
at onCompiled (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98597:20)
at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:99008:23
at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:97408:14
at eval (eval at create (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147581:10), :37:1)
error Command failed with exit code 1.

@JeromeLin
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的这个更改会导致打包报错。

JisonLexerError: Lexical error on line 1: Unrecognized text.

Erroneous area: 1: 0.75 / $activity-indicator-spinner-count * ($i - 1) ^.........^ at /wwwroot/umi.e6377a7f.css:1651:3 at Object.parseError (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1060336) at Object.lexer_parseError [as parseError] (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1067523) at Object.lexer_next [as next] (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1077684) at Object.lexer_fastLex [as fastLex] (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1078466) at fastLex (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1063127) at Parser.parse (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1063649) at /wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1053275 at walk (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1142146) at ValueParser.walk (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1137452) at transformValue (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1053157) at _default (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1053730) at callback (/wwwroot/node_modules/@umijs/deps/compiled/optimize-css-assets-webpack-plugin/index.js:1:1046407) at callback (/wwwroot/node_modules/postcss/lib/container.es6:110:18) at Rule.each (/wwwroot/node_modules/postcss/lib/container.es6:76:16) at Rule.walk (/wwwroot/node_modules/postcss/lib/container.es6:107:17) at /wwwroot/node_modules/postcss/lib/container.es6:121:24 { hash: { errStr: 'Lexical error on line 1: Unrecognized text.\n' + '\n' + ' Erroneous area:\n' + '1: 0.75 / $activity-indicator-spinner-count * ($i - 1)\n' + '^.........^', recoverable: false, text: '', token: null, line: 0, loc: { first_line: 1, first_column: 7, last_line: 1, last_column: 7, range: [Array] }, yy: { parseError: undefined, quoteName: undefined, lexer: undefined, parser: undefined, pre_parse: undefined, post_parse: undefined, pre_lex: undefined, post_lex: undefined }, lexer: { yy: {}, __decompressed: true, _input: '', yytext: '', yyleng: 0, match: '', matches: false, _more: false, _backtrack: false, yylloc: [Object], _signaled_error_token: false, done: false, yylineno: 0, matched: '', conditionStack: [Array], currentRuleSet: null, offset: 0 }, destroy: [Function: destructLexErrorInfo] }, postcssNode: Declaration { raws: { before: '\n ', between: ':' }, type: 'decl', parent: Rule { raws: [Object], type: 'rule', nodes: [Array], parent: [Root], source: [Object], selector: '.za-activity-indicator--spinner div:nth-of-type(1)', lastEach: 9, indexes: [Object] }, source: { start: [Object], input: [Input], end: [Object] }, prop: 'opacity', value: '1-calc(0.75 / $activity-indicator-spinner-count * ($i - 1))' } } build failed Error: build failed at /wwwroot/node_modules/@umijs/bundler-webpack/lib/index.js:172:29 at finalCallback (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108196:12) at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108217:14 at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:67111:7 at done (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:67206:13) at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108128:23 at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108209:15 at finalCallback (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98589:39) at onCompiled (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98597:20) at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:99008:23 at /wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:97408:14 at eval (eval at create (/wwwroot/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147581:10), :37:1) error Command failed with exit code 1.

2.9.15 已修复

Please sign in to comment.