Answer the question
In order to leave comments, you need to log in
How to insert css code from file into Twig template?
Converting .twig files via gulp using gulp-twig. In the template, you need to insert css code from the service.css file into the tag
How to do it?
I saw advice on stackoverflow, but it didn't work like this:<style></style>
<style>
{{ source('./_service/service.css') }}
</style>
<style>
Template "./_service/service.css" is not defined.
</style>
Answer the question
In order to leave comments, you need to log in
Write a function for twig. It will simply read and return the contents of the file.
In principle, the regular source() does the same thing, you just pass the wrong path to it.
Pass the base: 'src/twig_tpl' option to the twig() call settings (well, this is the path to the templates) and then specify the paths in the templates from this folder
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question