jahaziel17 / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

bourbonCss processor not working with Maven wro4j plugin #620

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Configure Maven WRO4J Plugin in the POM (cf. pom.snippet.xml joined file),
2. Add the bourboncss as pre-processor (cf.wro.properties),
3. Add an import into your SCSS file (@import "bourbon"; as the first line),
4. Use some Bourbon mixin in your SCSS (@box-shadow for instance).

What is the expected output?
Getting bourbon defined mixin working.

What do you see instead?
The following error message: “File to import not found or unreadable: 
bourbon.”.

What version of the product are you using? On what operating system?
Used on Windows XP with the versions of WRO4J indicated in the POM snippet.

Please provide any additional information below.
Hard to know how to make the whole thing work because there is very few 
documentation on the use of bourbonCss at compile time.

Original issue reported on code.google.com by stephane...@gmail.com on 28 Nov 2012 at 10:10

Attachments:

GoogleCodeExporter commented 8 years ago
Are you sure a resource named bourbon exists? The @import statement which is 
handled by CssImportPreProcessor retrieves resources exactly by their name, it 
doesn't assume any extension. The message you see is caused by 
CssImportPreProcessor and has nothing to do with BourbonCss processor.

Original comment by alex.obj...@gmail.com on 30 Nov 2012 at 8:23

GoogleCodeExporter commented 8 years ago
Indeed, I don't have any resource named bourbon.

You say the message is caused by CssImportPreProcessor, but as you can see in 
my wro.properties, I haven't declared this processor. From what I have read, 
this processor only handle classic CSS import, and no SASS style import, thus 
is not relevant here.

You say the message is caused by CssImportPreProcessor, but as you can see in 
my wro.properties, I haven't declared this processor.

I just want to use some Bourbon mixins (box-shadow for instance).

With bourbonCss as a declared processor and no import, I have an error message: 
Undefined mixin 'box-shadow'.

So I follow the classic way to use Bourbon is SASS which is declaring: @import 
"bourbon";. And here I have the bug reported.

The fact is that there is a bourbonCss processor that seems to be intended at 
making available Bourbon mixins in SASS files. I haven't found any 
documentation on how to integrate it at build time (nor at runtime, but I 
doesn't use runtime processing). And my two above described attempts have 
failed. From my current understanding of the problem, the bourbonCss processor 
doesn't work as expected, though my bug report.

Original comment by stephane...@gmail.com on 3 Dec 2012 at 8:58

GoogleCodeExporter commented 8 years ago
The bourbonCssProcessor uses a ruby based underlying library, which probably 
has some problems whith retrieving @import's ... also even if it wouldn't have 
any problems, it wouldn't work for all situations because wro4j handles 
resources located on arbitrary locations (ex: classpath) which cannot be 
handled by other libraries. This is the reason why the CssImportPreProcessor is 
important.

My recommendation: 
- add cssImportPreProcessor as a pre-processor
- use correct name of resources in @import directive

if this doesn't work, let me know.

I'm closing this issue with WONTFIX resolution because of the following reasons:
- there is a solution which should work (please confirm that)
- there is not much I can do regarding underlying ruby library. It is being 
used as a dependency. If you can tweak it and use it as a custom dependency, 
feel free to do that.

If you don't agree with the proposed solution or if you would like to continue 
discussion on that issue, please reopen the issue.

Original comment by alex.obj...@gmail.com on 3 Dec 2012 at 10:20

GoogleCodeExporter commented 8 years ago
I don't understand your recommandation.

Bourbon CSS processor seems to have been created to ease the use of Bourbon 
mixins in SASS files, wihtout having to get a manual local download of the 
bourbon library.

I don't see how cssImportPreProcessor could fix the problem. In fact, I have no 
bourbon.scss file beside by own SCSS file. And, as I stated above, 
cssImportPreProcessor isn't aimed for SCSS import but for standard CSS import. 
Bourbon make use of cascading SCSS import that will not work with 
cssImportPreProcessor. So, from my point of view, your solution doesn't work.

I'm not very versed in Ruby, so not really confortable with tweaking the whole 
thing from my own.

Perhaps the correct bug report would have been: “There are no clear 
explanation on how to make bourbonCss processor work.”, because, in its 
current state, I don't see the point of this processor.

Original comment by stephane...@gmail.com on 5 Dec 2012 at 11:10

GoogleCodeExporter commented 8 years ago
could you attach the resource which fails to be processed? 

Original comment by alex.obj...@gmail.com on 5 Dec 2012 at 11:25

GoogleCodeExporter commented 8 years ago
Also one small remark - the cssImportPreProcessor can handle not only css 
resources but also sass and less.

Original comment by alex.obj...@gmail.com on 5 Dec 2012 at 11:26

GoogleCodeExporter commented 8 years ago
I have created a sample project that reproduce the bug with the simplest subset 
of files and config. If you can look at it and tell me if I'm wrong with my 
config or if this bug is rightful.

Original comment by stephane...@gmail.com on 7 Dec 2012 at 10:02

Attachments:

GoogleCodeExporter commented 8 years ago
I've analyzed the resources you are using to process with bourbonCss processor.

You are saying that the processor fails when processing the following resource:

@charset "utf-8";

@import "bourbon";

div {
    @include box-shadow(0 0 5px 3px hsla(0, 0%, 0%, 0.65));
}

As I mentioned previously, the processor fails because the imported relative 
resource  called "bourbon" doesn't exist. 
The workaround to this problem is to resolve the missing import using cssImport 
processor which is responsible for replacing the @import statement with actual 
resource content. 

Let me know if you have more questions.

Original comment by alex.obj...@gmail.com on 8 Dec 2012 at 10:54

GoogleCodeExporter commented 8 years ago
Ok. I think either I misunderstood the use of bourbonCss processor, or you 
didn't catch the meaning of my bug report (thing for which I endorsed full 
responsibility, not making my though enough clear).

To be sure, I have tried your last proposal. I have put cssImport processor in 
my wro.properties. But, it doesn't work. In fact, I don't see how this could 
work:
* I haven't downloaded a local copy of the Bourbon SCSS files, so cssImport 
couldn't find anything to import,
* moreover, with a local copy, SCSS files are hierarchical (cascading imports) 
and, as far as I have understand it, cssImport processor only deals with 
regular CSS files and doesn't handle SCSS specifities like transitive imports.

Now, what I have understand of the goal of bourbonCss processor (correct me if 
I'm wrong): this processor aimed at alleviating the use of Bourbon mixins in 
SCSS files, handling transparently the import of bourbon requirements behind 
the scene. The user doesn't need to retrieve a working Bourbon distrib in his 
project. This is the sense of my bug report because I doesn't succeed in making 
it work this way.

Finally, this bug report and this incomprenhension is mainly due to a lack of 
documentation on this specific bourbonCss processor. When I will have 
understand how it works, I would be glad to contribute on this documentation.

Thanks for taking time on watching at this.

Original comment by stephane...@gmail.com on 11 Dec 2012 at 1:05

GoogleCodeExporter commented 8 years ago
Ok, I see now. Indeed, the processor doesn't provide the bourbon
distribution. I will ask the author of the processor about this. Thanks for
reporting.

Original comment by alex.obj...@gmail.com on 11 Dec 2012 at 1:10

GoogleCodeExporter commented 8 years ago
Thanks a lot. Should the bug stay in WontFix?

Original comment by stephane...@gmail.com on 12 Dec 2012 at 11:07

GoogleCodeExporter commented 8 years ago
no, feel free to reopen it.

Original comment by alex.obj...@gmail.com on 12 Dec 2012 at 11:22

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Changing status to Accepted.

Original comment by alex.obj...@gmail.com on 12 Dec 2012 at 1:07

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks for having reopened it.

Original comment by stephane...@gmail.com on 12 Dec 2012 at 4:22

GoogleCodeExporter commented 8 years ago
Read the description provided by bourbon processor 
contributor:https://github.com/alexo/wro4j/pull/45#issuecomment-11307997

Original comment by alex.obj...@gmail.com on 12 Dec 2012 at 8:59

GoogleCodeExporter commented 8 years ago
Ok, thanks for this clear explanation. The bourbonCss only transparently handle 
Bourbon functions.

Does this bug should still stay opened? It would be a great enhancement if the 
unpacking of Bourbon wasn't needed, but perhaps it's difficult to achieve.

I let you decide what to do about this bug. Thanks for having take time to deal 
with it and for your work on wro4j in general.

Original comment by stephane...@gmail.com on 13 Dec 2012 at 9:07

GoogleCodeExporter commented 8 years ago
As Simon mentioned, the bourbon distribution is embedded in bourbon jar 
package, meaning that you can use @import referring the classpath resource, 
example:

@import("classpath:gems/bourbon-2.1.0/app/assets/stylesheets/_bourbon.scss")

Of course, the cssImport processor is required for this. Please try and let me 
know if that works for you.

If you think that the proposed solution is good enough, I'll close the issue. 
Otherwise, we can continue to discuss it here if there are other suggestions.

Original comment by alex.obj...@gmail.com on 13 Dec 2012 at 9:14

GoogleCodeExporter commented 8 years ago
I didn't manage to get the import working with the classpath syntax and 
cssImport processor. Haven't found any doc on this syntax, so don't know if I'm 
misusing it or if it's another problem.

Moreover, imports with cssImport doesn't work with cascading SCSS imports 
(_bourbon.scss imports other SCSS files).

In the current state, I don't see a easy way to make the whole thing work 
without unpacking the Bourbon distrib and merging its files with wro4j. I will 
try it soon and will give you feedback.

I think that this bug is finally very linked to this other one : 
http://code.google.com/p/wro4j/issues/detail?id=487, which deals with SCSS 
imports not working with SASS processor. Solving one may be a step toward 
solving the other.

You could keep this bug opened until I made this unpacking test and give you 
feedback.

Original comment by stephane...@gmail.com on 14 Dec 2012 at 5:07