Skip to content

Commit

Permalink
🏗 Replace hack to prevent inlining of cssText with a @noinline anno…
Browse files Browse the repository at this point in the history
…tation (ampproject#23373)
  • Loading branch information
rsimha authored and RINDO committed Jul 24, 2019
1 parent 0be932e commit cb0a21c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Binary file modified build-system/runner/dist/runner.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ public AmpCodingConvention(CodingConvention convention) {
* delivery), this could go away there.
*/
@Override public boolean isExported(String name, boolean local) {
// Bad hack, but we should really not try to inline CSS as these strings can
// be very long.
// See https://github.com/ampproject/amphtml/issues/10118
// cssText is defined in build-system/tasks/css.js#writeCss
if (name.startsWith("cssText$$module$build$")) {
return true;
}

if (local) {
return false;
}
Expand Down
11 changes: 7 additions & 4 deletions build-system/tasks/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ function compileCss(watch, opt_compileAll) {
*/
function writeCss(css, jsFilename, cssFilename, append) {
return toPromise(
// cssText is hardcoded in AmpCodingConvention.java
file(jsFilename, 'export const cssText = ' + JSON.stringify(css), {
src: true,
})
file(
jsFilename,
'/** @noinline */ export const cssText = ' + JSON.stringify(css),
{
src: true,
}
)
.pipe(gulp.dest('build'))
.on('end', function() {
mkdirSync('build');
Expand Down

0 comments on commit cb0a21c

Please sign in to comment.