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

Remove sass 3 #1336

Merged
merged 7 commits into from
May 27, 2021
Merged

Remove sass 3 #1336

merged 7 commits into from
May 27, 2021

Conversation

allthesignals
Copy link
Collaborator

@allthesignals allthesignals commented May 26, 2021

Related: NYCPlanning/labs-ui#77

Currently, the app's Sass dependencies require a large C library. This causes issues on some machines, requiring intermittent rebuilds of the node bindings (node-sass). This setup-time/build-time overhead is not worth the cost in exchange for some easier-to-use application-specific styles.

This PR switches the app away from using ember-cli-sass & node-sass to compile sass from dependencies and project-specific sass files, and instead moves it to using Postcss to compile the styles without the need for the node-sass bindings/C library. This reduces the overhead of initial setup and likelihood of seeing issues due to low-level dependencies.

Additionally, switching to PostCSS positions the app, and future apps, to pivot towards a more modern styling library, such as Tailwind. The benefit here is that it still compiles all Sass dependencies with minimal difference from the previous compiler.

That said, I had to migrate some of the styles and components from labs-ui, and remove labs-ui altogether. The reason for this is frustrating: labs-zap-search is dependent on 0.0.26 of labs-ui (see issue). It's unclear why the upgraded styles for the "1.0" version of labs-ui don't work for this app. Additionally, labs-ui implicitly requires node-sass, thwarting the point of switching away from node-sass-based approach. To get around that, I removed labs-ui, copied the site-header component (it was the only one being used) and copied a few styles from the 0.0.26 version of labs-ui. So, there is some bulk in the diff, but it almost entirely comes from labs-ui.

Extras:

  • Eliminate some caniuse/browserlist warnings
  • Use "concurrently" to run frontend/backend command for cleaner shutdown

@allthesignals allthesignals requested a review from a team as a code owner May 26, 2021 21:02
@@ -2,8 +2,7 @@
. "$(dirname "$0")/_/husky.sh"

cd client
yarn run test
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏾

@@ -0,0 +1,14 @@
import Component from '@ember/component';

export default Component.extend({
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the new new site-header, site-title component because you removed labs-ui?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@godfreyyeung yup it's the copied over version. see updated description for why


@import 'foundation';
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for ? I thought we're moving away from foundation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@godfreyyeung no not yet, I'm still preserving everything foundation-related because I'm not ready to overhaul the entire thing yet. This is a seemingly "newer" way to import foundation dependencies.

client/yalc.lock Outdated
"replaced": "^0.0.26"
}
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

delete

@@ -0,0 +1 @@
{{yield}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

delete

@@ -0,0 +1 @@
{{yield}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

delete

@@ -0,0 +1,14 @@
import Component from '@ember/component';

export default Component.extend({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@godfreyyeung yup it's the copied over version. see updated description for why


@import 'foundation';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@godfreyyeung no not yet, I'm still preserving everything foundation-related because I'm not ready to overhaul the entire thing yet. This is a seemingly "newer" way to import foundation dependencies.

Copy link
Contributor

@godfreyyeung godfreyyeung left a comment

Choose a reason for hiding this comment

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

Cool. Since PostCSS is also node based... I don't understand theoretically how/if it really switches away from node bindings/C libraries, and how that is the key to clearing those compile errors. Has postcss-sass been more stable in your experiments?

@allthesignals
Copy link
Collaborator Author

Cool. Since PostCSS is also node based... I don't understand theoretically how/if it really switches away from node bindings/C libraries, and how that is the key to clearing those compile errors. Has postcss-sass been more stable in your experiments?

It has, yes. Yes, PostCSS is node-based, so is node-sass... what I meant was that I wanted to eliminate the dependency on libsass, which is deprecated anyway:

image

The source of the intermittent compile errors is the node-sass bindings which are necessary for node environments to interact with libsass, the C library.

@allthesignals allthesignals merged commit 0f7242c into develop May 27, 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