-
Notifications
You must be signed in to change notification settings - Fork 136
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
Confusion about the "external dependencies" in themes #173
Comments
Hello @CookiePLMonster, I am pinging @ntkme so that they may be able to shed some light or point you to relevant documentation on Dart Sass. |
That makes sense. Perhaps this comes from a misunderstanding of what "external dependencies" in Dart Sass are, but I was hoping to be able to separate partials coming from my theme that I wrote and have full control over, from "external" partials I pulled into the project like Font Awesome, where it's not feasible for me to correct all deprecation warnings (especially the ones related to |
You may disable deprecation warnings related to # _config.yml
sass:
quiet_deps: true
silence_deprecations:
- import Other types of warnings can be added to the list above. Though, you'll have to refer the Dart Sass docs for the exact identifier for the type of deprecated feature. |
Indeed, and that's what I tried just before opening this ticket. However, Font Awesome also throws multiple other warnings (e.g. about a deprecated |
The definition of “dependency” is stylesheet resolved from load_paths. Stylesheet resolved as relative path does not count. |
My |
Stylesheet resolved as relative path does not count, even if the file is located in the load_paths. Note _sass (sass_dir) is a default load path. |
For the structure you have, what you can do is: // main
@use "../../_sass/theme"; // this is a relative path, does not count as dependency. Add // theme
@use "font-awesome"; |
This works, but it's admittedly quite "ugly" and doesn't look quite right - which brings me to my original question, what would be the "right" way to do it, short of putting all my sass code in |
The reason is that for most of the end users who import the root stylesheet for a theme e.g. minima, that whole theme is a dependency which users do not care about those warnings. So treat the whole theme as dependency is actually intended behavior. I understand that this is a bit inconvenient for you as a theme author, but relative import vs load_path is the only difference for sass compiler to consider if a file is a dependency or not. What I do in my own project is that I use npm to install all external dependencies, and I add |
Thank you for your insights, @ntkme. |
That clears things up for me, thanks! I haven't considered this particular scenario and that my workflow of maintaining the blog contents together with a theme may be an outlier. With this in mind, I now understand why I need to resort to an "ugly" relative path. Should I keep this issue open for the sake of a readme update @ashmaroli mentioned? Otherwise I'll try it out again in the evening and close if everything works fine - as I have tried the relative path before opening the ticket but I have not tried adding |
You may leave this ticket open, @CookiePLMonster. You could however, update the title to better describe the actual issue 😉 |
quiet_deps
?
Sure, is this better? |
To add to that, looks like I may potentially be able to add Font Awesome as a Ruby gem and move it out of |
Another thing here is that you have Logically |
That’s for Ruby on Rails, which cannot be used for Jekyll at this moment. |
I see, my bad - there are separate |
Jekyll ignores copying filenames started with underscore, and sass consider underscore as a partial, which can be imported without the underscore prefix. E.g. you can have |
I tested, and everything worked as expected! In case anyone in the future has similar doubts to me and needs help, here's what I did to my theme:
Now I am getting all warnings for my own theme (there actually were a few deprecation warnings that snuck under the radar!), while externals like Font Awesome don't get warnings. Thank you both for your help! |
Having migrated from jekyll-sass-converter 2.x to 3.x, I started getting many deprecation warnings related to a new Dart Sass. I fixed them in my own SCSS files, but I can't fix all of them coming from external dependencies like Font Awesome.
quiet_deps
should be able to help me, but I don't know how to correctly restructure the_sass
folder to have my partials considered "internal" and Font Awesome "external".My
_config.yml
:My files are structured as follows:
Where
main.scss
isI tried removing the use of
theme.scss
and listing all my partials directly inmain.scss
, that didn't help. The only thing that did help was removing the Font Awesome partial fromtheme.scss
and changingmain.scss
to:But this is probably not how it's supposed to be used.
TL;DR: Is there a way to restructure my
_sass
directory to consider my partials "internal" and get all SASS warnings, while partials from theexternal
directory as external dependencies that do not get warnings?The text was updated successfully, but these errors were encountered: