Creating a primer_view_components.css bundle that will ship with the npm package #1316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
We've talked a few times about the overhead it takes to develop components twice for rails architecture. Once in primer/css and again in primer/view_components. This disconnect can lead to multiple versions and iterations happening in primer/css before any component is actually ready. 1 2 3 4 5 6
This pull aims to mirror what we did for delivering web-components with PVC but for CSS. We worked on this in another PR to see if we could render a
SegmentedControl
#1315 to add a postcss pipeline and compile thesegmented_control.css
. Ideally I would like to leave the bundle in this PR empty, and add the component css in mysegmented_control
branch.How
Because this is essentially a new build system, we want to be more forward thinking with the code written here and opt for using PostCSS with the preset-env plugin that allows us to write more CSS spec features like, nested selectors, match functions, container queries etc.
SegmentedControl
rendered from the PVC package. What you're seeing on that page is the component rendered with the CSS provided by the bundle.pre
version from this pull request that contains an empty for now css bundle file compiled from theprimer.css
source.Currently this runs on the
build:css
package.json script. Running a postcss-cli command. I intentionally left this pretty simple because I figured we might want to integrate this into rollup or webpack later.In our github.com production bundle we have a few options:
@import "@primer/view-components/app/assets/styles/primer_view_components.css"
import line. This is most likely what we'll start with.Footnotes
https://github.com/primer/css/pull/2083 ↩
https://github.com/primer/css/pull/2174 ↩
https://github.com/primer/css/pull/2194 ↩
https://github.com/primer/css/pull/2195 ↩
https://github.com/primer/css/pull/2202 ↩
https://github.com/primer/css/pull/2205 ↩