luciopaiva / witchcraft

Inject Javascript and CSS right from your file system. Think GreaseMonkey for more advanced users.
https://luciopaiva.com/witchcraft
MIT License
260 stars 19 forks source link

@include directives for CSS #3

Closed luciopaiva closed 4 years ago

luciopaiva commented 7 years ago

The same that exists for JS, but for CSS. Something in the lines of /* @include foo.css */.

luciopaiva commented 6 years ago

As of v2.1, this is probably a bug now, since the @include directive processor is running the same logic for both js and css files. Must verify and fix this.

infostatus commented 5 years ago

Hi Lúcio. How can I use this to include external JS files like jQuery or Firebase in my scripts?

I've tried: / @include https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js / But when I try to use in my code the variable doesn't not exists.

With greasemonkey it's possible to do: // @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js

Loving Witchcraft, just what I needed, if I get this to work it would be perfect! Obrigado!

luciopaiva commented 5 years ago

Hi @infostatus,

Witchcraft currently only loads local scripts. To work around your problem, simply download jquery.min.js to your local folder and then:

// @include jquery.min.js

It will work just fine.

Also notice it must be a single line comment. Multi line comments are not supported yet.

Please let me know if it worked. Meanwhile, I'll open a ticket to allow for including resources from the web.