-
-
Notifications
You must be signed in to change notification settings - Fork 369
[Question] Can you suggest a way to @import less code form a different app #749
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
Comments
If the collector is enabled (PIPELINE_COLLECTOR_ENABLED is True), use the collected file. If the disabled (False), use the original project source file to check if it is outdated and pick up the changes. This will allow for static files (in particular less CSS compiler) files to do relative imports from different apps. See: jazzband#749
I created this PR: |
Importing other apps styles is handled differently in live and dev environments as the dev environment processes the non collected file and live processes the collected file. There is an existing ticket for this: jazzband/django-pipeline#749 which has a PR. To fix this we've forked the fixed version and are using that directly from github rather than pulling in an official package.
Also running into this problem with SASS It seems to be possible to write the imports in a way that they In (a) imports must be relative to the It's really a showstopper for us, because we have styles reused in different Django projects. It looks like there are a couple of forgotten PRs that attempt to fix the problem: as well as an abandoned discussion in #487 @peymanslh any suggestions on how to make this work? |
Hi,
I'm migrating a project from Django 1.11 to 3.2, and also migrating django-pipeline from 1.6.9 to 2.0.6.
Now, we have many django apps and in one app I'm importing less (CSS compiler) code from another app:
in
admin_main/static/admin_main/less/common.less
, which is located inside theadmin_main
app I haveAll these 4 less files are located in the
common
app:common/static/common/third_party/bootstrap/less/variables.less
common/static/common/less/styles/flexbox.less
common/static/common/less/lib/spacing.less
common/static/common/less/lib/ng-animate.less
The problem is when collecting statics and compiling
admin_main/static/admin_main/less/common.less
,lessc
cannot find the imported files, because these files are in a complete different directory, and the relative paths cannot be found.With django-pipeline 1.6.9 these files were found, because the file to process was not the project file, but the collected file inside my collectedstatic directory:
deploy/admin/collectedstatic/admin_main/less/common.less
, and of course the 4 imported files are also inside the collectedstatic directory, and all works, becauselessc
can find them in the same collectedstatic directory.I have found that the problem was introduced by this commit:
63d1182
When I revert the commit it works as before. For now, I'm going to fork and use a customized version of django-pipeline.
I kindly ask: is it possible, and how do you suggest to solve these relative imports from a different Django application with the official django-pipeline package?
Is it OK to create a Pull Request to modify that commit and only use the
project_infile
whenPIPELINE_COLLECTOR_ENABLED == False
?Thank you for the time you can spend on this.
The text was updated successfully, but these errors were encountered: