Skip to content
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

Nested import handling #29

Merged
merged 7 commits into from
Feb 3, 2021
Merged

Conversation

jerekshoe
Copy link
Collaborator

@jerekshoe jerekshoe commented Jan 15, 2021

This PR should address #28

Changes

This PR does 3 things:

  1. When bundling, recursively get the order of css imports
  2. When watching, changes to import order are now handled
  3. Adds a new test for nested imports

Illustration

Import Structure

main.js
|---- b.js
|     |---- b.css
|---- r.css
|---- g.css

Output Structure

b.css
r.css
g.css

Notes

  • Transform only gets called for changed files
  • The order in which transport is called on changed files is not guaranteed

src/index.js Show resolved Hide resolved
thgh
thgh previously approved these changes Jan 19, 2021
Copy link
Owner

@thgh thgh left a comment

Choose a reason for hiding this comment

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

I'm not actively using this, so if someone else can confirm that this is what they expect, I will merge this.

@@ -1,14 +1,43 @@
import { createFilter } from '@rollup/pluginutils'

var arraysEqual = function(a, b) {
Copy link
Owner

Choose a reason for hiding this comment

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

Do you mind moving helper functions to the bottom of the file?

Also, I prefer

Suggested change
var arraysEqual = function(a, b) {
function arraysEqual(a, b) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would it be ok if I created a util.js (or similar) file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If not, I will move to the bottom of the file as suggested

Copy link
Owner

Choose a reason for hiding this comment

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

Bottom seems fine :-)

src/index.js Show resolved Hide resolved
src/index.js Show resolved Hide resolved
src/index.js Show resolved Hide resolved
@thgh thgh changed the base branch from master to v4 February 3, 2021 13:56
@thgh thgh dismissed their stale review February 3, 2021 13:56

The base branch was changed.

@thgh thgh merged commit ba3e96e into thgh:v4 Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants