-
Notifications
You must be signed in to change notification settings - Fork 90
feat(sass): Added Support for Less to Sass Conversion #692
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
feat(sass): Added Support for Less to Sass Conversion #692
Conversation
Do we want a top level |
9602bd0
to
9cddafd
Compare
Do you mean in addition to |
Don't know why Travis is failing with:
|
Yes. The build.scss file is for dev/test purposes to build css from the sass (since sass ignores partials by default, you can't compile from a file that starts with |
9cddafd
to
36d61ab
Compare
Ok, implemented this. May need a little help documenting how app devs are supposed to consume |
@dtaylor113 I just opened a PR on your fork to flatten the As far as downstream consumption, in most use cases, people should be able to just add |
e3d0d66
to
c540572
Compare
Awesome! Thanks @TheRealJon !!! |
Arrrrg...Travis still failing with:
|
Yeah, I just noticed this. I don't know why. The build runs fine on my machine. I'll fiddle around with it and see if I can figure something out. |
c540572
to
2b2bf10
Compare
Thanks @TheRealJon the switch to |
styles/build.scss
Outdated
@@ -0,0 +1 @@ | |||
@import 'angular-patternfly.scss'; |
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.
@dtaylor113 can you remove the .scss
extension from this import statement so that all of the imports are standardized?
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.
ok, done
2b2bf10
to
fe1bfc2
Compare
@@ -11,7 +11,7 @@ globals: | |||
rules: | |||
strict: [2, "function"] | |||
quotes: 0 | |||
camelcase: 2 | |||
camelcase: 1 |
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.
Is there a reason for this change?
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.
Yes, was throwing an error due to new task in gruntfile 'convert_within_custom_replacements' not being camelcase:
lessToSass: {
convert_within_custom_replacements:
@@ -0,0 +1 @@ | |||
@import 'angular-patternfly'; |
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 this file needs to be named angular-patternfly.scss for it to be intuitive for consumption. This likely means moving the partials into a sub-directory or adding all the partials here rather than having an _angular-patternfly.scss
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.
@TheRealJon recommended the main partial:
"Yes. The build.scss file is for dev/test purposes to build css from the sass (since sass ignores partials by default, you can't compile from a file that starts with _). The _angular-patternfly.scss partial would ship in dist so that it could be consumed. That way consumers don't have to import individual partials. Then build.scss could also just @import 'angular-patternfly';."
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 it needs to begin with a "_" in order to be @import
'ed
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.
It doesn't have to start with an underscore, but we are doing it that way in patternfly core, so I figured it would be better to keep things consistent. It's also done similarly in other libraries like bootstrap-sass and font-awesome-sass.
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.
Just tested renaming to "angular-patternfly.scss" and css generated correctly. Just want to make sure that "...The angular-patternfly.scss partial would ship in dist so that it could be consumed. That way consumers don't have to import individual partials.." is still correct. In other words, app devs can sill consume (@import?) 'dist/angular-patternfly.scss', even though it doesn't begin with an underscore. -thanks
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.
OK, this is fine then.
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.
Just as a reference:
Sass does a bit of magic with imports and file names, so those sections definitely cleared some confusion up for me.
I think this should be a feat. This is worthy of a point release. |
c45f3d4
fe1bfc2
to
c45f3d4
Compare
Description
From the updated README.md:
Less to Sass Conversion
During the build process Less files are converted to Sass files in
/dist/sass
. Then the Sass files are compiled into/dist/sass/angular-patternfly.css
. If you would like to copy the Sass generated css into the main/dist/styles
directory, execute:This task will copy
/dist/sass/angular-patternfly.css
to/dist/styles/angular-patternfly.css
. Then the build process will minimize the css in/dist/styles
.The Less to Sass Conversion step will be accomplished and managed as a part of any Pull Request which includes Less file changes. Although contributors may want to build and test their style changes with Sass before submitting a Pull Request, this step should always be tested and validated by reviewers before a style change is merged and released. If a contributor is having issues with Sass conversion that they cannot resolve, Pull Request reviewers will need to ensure that the Sass conversion step is successfully accomplished, tested, and included in the Pull Request before it is approved and merged.
For more detailed information, please read PatternFly Less to Sass Conversion
Note: When a Less file is added/deleted/renamed it needs to be updated in the main Less import file
/styles/angular-patternfly.less
and the main Sass import file/styles/_angular-patternfly.scss
.New
dist/sass
directory and files.Fixes: #688
The sass-2-css file is almost identical to the less-2-css file; just diffs in line breaks. The minified versions are identical!
**Thanks to @TheRealJon for leading the way in the less-2-sass conversion process :-)