-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨🏗 add cssBinaries options for extra css outputs for an extension #13303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@newmuis Is amp-story still using the shadow DOM approach for style isolation?
gulpfile.js
Outdated
if (options.compileOnlyCss) { | ||
return Promise.resolve(); | ||
} | ||
return buildExtensionJs(path, name, version, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should be extracted and called in buildExtension
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a function called buildExtension
: https://github.com/ampproject/amphtml/blob/master/gulpfile.js#L508
Just re-read the above comment. Never mind :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
gulpfile.js
Outdated
} | ||
const promises = []; | ||
const mainCssBinary = jsifyCssAsync(path + '/' + name + '.css') | ||
.then(writeCssBinaries.bind(null, `${name}-${version}.css`)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think this is a bit more readable.
.then(() => writeCssBinaries(`${name}-${version}.css`))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would need to write it as .then(css => writeCssBinaries(`${name}-${version}.css`, css))
to get the equivalent. (I'm ok with rewriting it to this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@choumx We would like to use shadow DOM for isolation, but are blocked by this |
* loadPriority: ?string, | ||
* cssBinaries: ?Array<string>, | ||
* extraGlobs?Array<string>, | ||
* bundleOnlyIfListedInFiles: ?boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a declaration for the same key that's currently being used in buildExtensions
, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think so. i was having a hard time tracking if its still the same options object but i believe so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose testing with --files
should make it clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it's worth testing this code with a couple variations of gulp | gulp dist --fortesting
with the args --noextensions | --extensions=minimal_set
since that behavior depends on CSS compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. tested
gulpfile.js
Outdated
if (options.compileOnlyCss) { | ||
return Promise.resolve(); | ||
} | ||
return buildExtensionJs(path, name, version, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a function called buildExtension
: https://github.com/ampproject/amphtml/blob/master/gulpfile.js#L508
Just re-read the above comment. Never mind :)
/cc @gmajoulet |
* loadPriority: ?string, | ||
* cssBinaries: ?Array<string>, | ||
* extraGlobs?Array<string>, | ||
* bundleOnlyIfListedInFiles: ?boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose testing with --files
should make it clear.
d33b915
to
489a3cc
Compare
489a3cc
to
61d7f31
Compare
option will look like: