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

FIX - Revise LTR/RTL configuration to not use import + if statements #263

Merged
merged 1 commit into from
Jan 25, 2016

Conversation

talbs
Copy link
Contributor

@talbs talbs commented Jan 22, 2016

We ran into the issue of edx-platform Sass not being able to compile UXPL-based project Sass compilation files due to the following error:

Import directives may not be used within control directives or mixins.

After looking into things more via the following threads, its best to move away from leveraging importing RTL/LTR support using a Sass @if clause.


This work revises the LTR/RTL config and settings to not rely on Sass @import + @if since Sass doesn't support @import statements inside of @if syntax. More details on the steps include:

  • rolled back to using specific bi-app-sass imports for LTR/RTL cases
  • updated all UXPL package and Doc Site Sass compilation files to use the new method
  • moved if/else -direction variable use to be within _grid.scss

Reviewers

If you've been tagged for review, please check your corresponding box once you've given the 👍.

Post-review

  • Squash commits
  • Publish packages/doc site

@if $layout-direction == rtl {
$grid-direction-default: rtl;
$grid-direction-reversed: ltr;

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: extra line

@dsjen
Copy link
Contributor

dsjen commented Jan 22, 2016

🌟 LGTM 🌟

// ------------------------------
// #LIB
// ------------------------------
@import '../../../node_modules/bi-app-sass/bi-app/bi-app-ltr';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'm wondering if we should add partials for _ltr.scss and _rtl.scss. I'm not super comfortable with every client of the pattern library having to know that we're using bi-app, and it would make it harder to change that dependency. I'm also wondering if we might eventually have some additional actions that we'd perform in these partials, so having them broken out now would make that easier.

Does that make sense? Am I missing something as to why this is a bad idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, that partial could set the $layout-direction too so that wouldn't have to be repeated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @andy-armstrong! That's damn good feedback and simplifying this more makes sense.

I've gone ahead and done that with this fixup! commit (a4dc34d). The README file compilation examples have also bee updated. How does this sound?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great. Thanks!

@andy-armstrong
Copy link
Contributor

👍 Looks great to me.

@talbs talbs force-pushed the talbs/fix/ltr+rtl-configuration branch from 462cb7f to a4dc34d Compare January 25, 2016 15:12
@talbs
Copy link
Contributor Author

talbs commented Jan 25, 2016

@andy-armstrong and @dsjen, I addressed your good feedback. Let me know if you want to take another spin through or if I should move ahead with merging this and using it on our next steps in the platform work.

```

**NOTE**: Since both libSass and RubySass lack a way to pass in variables/configuration into their ``@import {file}`` method, each app is responsible for 1) storing any npm-based dependencies, including the edx-pattern-library, in the best directory structure for that app's set up and 2) creating a ``_lib.scss`` partial to import all third party library dependencies from that structure for the Pattern Library to use (see above example).

**NOTE**: We support right-to-left and left-to-right-based layouts. To suppor this within each app, we recommend including a ``_rtl.scss`` or ``_ltr.scss`` file that contains the right layout setting and reference to specific third party utilities.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: suppor

Copy link
Contributor

Choose a reason for hiding this comment

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

When you say "we recommend", does this mean that you can choose not to include one or the other? Does it matter that $layout-direction won't be set?

@andy-armstrong
Copy link
Contributor

👍

* Since Sass doesn't support @import statements inside of @if syntax
* rolled back to using specific bi-app-sass imports for LTR/RTL cases
* moved if/else -direction variable use to be within _grid.scss
@talbs talbs force-pushed the talbs/fix/ltr+rtl-configuration branch from f152346 to 322cc26 Compare January 25, 2016 16:10
talbs added a commit that referenced this pull request Jan 25, 2016
FIX - Revise LTR/RTL configuration to not use import + if statements
@talbs talbs merged commit 6384261 into master Jan 25, 2016
@talbs talbs deleted the talbs/fix/ltr+rtl-configuration branch January 25, 2016 16:11
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.

3 participants