Dropping target and relativeTo broke my workflow
See original GitHub issueHello,
I’ve been using clean-css
for some time now and I used both target
and relativeTo
options to create a “deployable” version of a website (at the same level of the project folder):
\project-A\ => project folder
\project-A-deploy\ => gulp generated distribution / deployable version
My projects follow this logic at the development folder:
\project-A\resouces\include\package-a\file-a.css
\project-A\resouces\include\package-a\image.png
\project-A\resouces\include\package-b\file-b.css
\project-A\resouces\style.css
resouces\include
is a folder where bower-installed packages end up;- those packages include CSS files and images, fonts etc;
- my code would merge all CSS from every package into a global
\project-A-deploy\resources\style.min.css
(rebased byclean-css
); - then it would find/copy additional resources like
image.png
to the distribution folder keeping the original directory structure. (eg. file\project-A\resouces\include\package-a\image.png
gets copied to\project-A-deploy\resouces\include\package-a\image.png
)
My problem:
Take \project-A\resouces\include\package-a\file-a.css
with the following contents as an example:
div.xpto {
background: url(image.png)
}
image.png
was located at \project-A\resouces\include\package-a\image.png
and it would load just fine.
When I merge all CSS, the url()
directive needs to take in account the path of the global CSS file at: \project-A-deploy\resources\style.min.css
. Meaning the CSS needed to be changed to:
div.xpto {
background: url(include\package-a\image.png)
}
Using the target
and relativeTo
I could make this url()
change by setting target: "resources"
and relativeTo: ""
. Without them I can’t make it do rebase as I described.
How can I, in v4, do this with rebaseTo
? How can I now emulate the behavior of target
and relativeTo
so I can take advantage of v4 with my desired workflow?
Thank you.
Issue Analytics
- State:
- Created 6 years ago
- Comments:28 (5 by maintainers)
Top GitHub Comments
@scniro and @jakubpawlowicz thanks for the feedback and work. I’ve tested that version against my test case and in a complex project with lots of other stuff and everything works just fine!
Any ETA for that code to be on the normal repo?
@TCB13 @lightwalker21 is this of any help - https://github.com/jakubpawlowicz/gulp-clean-css-v4-example? We had a long discussion about a similar (?) problem in https://github.com/jakubpawlowicz/clean-css/issues/854