0

I'm on a Symfony 4 new project.

Via yarn, I installed (by example) the CSS library animate.css

yarn install animate.css

From the webpack.config.js file, I added the animate.css file like that :

.addStyleEntry('animate', './node_modules/animate.css/animate.css')

My question is : is it a good way to add a CSS library like that ? I'm not sure if use directly the node_module path is a good practice..

Is there a better way ?

1 Answer 1

1

Normally you inject it directly in the .js file you are using

ex:

require('animate.css/animate.css')

or something in this way depending on your js superset if you have one so it will generate a .css file with your .js

an example is this: on my first line of my typescript file I call this import ./style.css
after that Encore will generate me a nwe .css file that i can use in my template using {{ encore_entry_link_tags('entry') }}

Sign up to request clarification or add additional context in comments.

2 Comments

This is the point, and I don't think it is good because I just want load a pure css library, Is a bit illogical to use a js way for load a pure css no ?
it is only in compile time, webpack Encore will generate a .css file and you would use this {{ encore_entry_link_tags('entry') }} to import your css

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.