Skip to content
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

Ability to @import from webjars #15

Open
be9 opened this issue Jan 10, 2016 · 5 comments
Open

Ability to @import from webjars #15

be9 opened this issue Jan 10, 2016 · 5 comments

Comments

@be9
Copy link

be9 commented Jan 10, 2016

I wonder if there is any possibility to do

@import 'bootstrap';

having [org.webjars/bootstrap "3.3.6"] in dependencies.

If that's not possible, what's the preferred way to pull 3rd party modules?

@Deraen
Copy link

Deraen commented Jan 10, 2016

I think something like this could work with [org.webjars.bower/bootstrap "4.0.0-alpha.2"]:

(comp
 ; Add files from Bootstrap webjar to fileset
 (sift :add-jar {'org.webjars.bower/bootstrap #"META-INF/resources/webjars"})
 ; Move files to sane path:
 ; e.g. META-INF/resources/webjars/bootstrap/4.0.0-alpha.2/scss/bootstrap.scss => bootstrap/scss/bootstrap.scss
 (sift :move {#"^META-INF/resources/webjars/bootstrap/[^\/]*/" "bootstrap/"})
 (sass))
@import 'bootstrap/scss/bootstrap`;

@be9
Copy link
Author

be9 commented Jan 10, 2016

This seems like a step into the right direction, however doesn't work.

[org.webjars/bootstrap "4.0.0-alpha.2"] in dependencies (org.webjars.bower/bootstrap gave me a NPE for some reason).

Here's the task:

(deftask mysass []
  (comp
    ; Add files from Bootstrap webjar to fileset
    (sift :add-jar {'org.webjars/bootstrap #"META-INF/resources/webjars"})
    ; Move files to sane path:
    ; e.g. META-INF/resources/webjars/bootstrap/4.0.0-alpha.2/scss/bootstrap.scss => bootstrap/scss/bootstrap.scss
    (sift :move {#"^META-INF/resources/webjars/bootstrap/[^\/]*/" "bootstrap/"})

    (sass :output-dir "stylesheets")
    (target :dir #{"target"})))

Here's the output:

~/hacks/funfin-reagent(branch:master*) » boot mysass                                                  be9@MBPbe9
Sifting output files...
Sifting output files...
Compiling bootstrap/scss/bootstrap.scss
Compiling bootstrap/scss/bootstrap-reboot.scss
Compiling stylesheets/style.scss
Error: File to import not found or unreadable: bootstrap/scss/bootstrap
       Parent style sheet: /Users/be9/.boot/cache/tmp/Users/be9/hacks/funfin-reagent/hrd/mh5540/stylesheets/style.scss
        on line 1 of ../../.boot/cache/tmp/Users/be9/hacks/funfin-reagent/hrd/mh5540/stylesheets/style.scss
>> @import 'bootstrap/scss/bootstrap';
   ^
             clojure.lang.ExceptionInfo: java.lang.Exception: sassc: non-zero exit status (1)

@Deraen
Copy link

Deraen commented Jan 10, 2016

You can try https://github.com/Deraen/sass4clj

It has built-in support for importing files from classpath and webjars.

@mathias
Copy link
Owner

mathias commented Jan 10, 2016

For cases like this, I definitely recommend https://github.com/Deraen/sass4clj

@be9
Copy link
Author

be9 commented Jan 11, 2016

@Deraen @mathias thanks for the advice, I had success with sass4clj.

I think the difference between the both should be somewhere on the wiki. Is boot-sassc expected to work faster as it just shells to sassc executable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants