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

How to use function "source"? #59

Open
crazydeath137 opened this issue Dec 10, 2018 · 1 comment
Open

How to use function "source"? #59

crazydeath137 opened this issue Dec 10, 2018 · 1 comment

Comments

@crazydeath137
Copy link

as I see, Twig has a good function named "source" : https://twig.symfony.com/doc/1.x/functions/source.html
But I can't use it in gulp-twig.
{{ source(file_path) }} --> all I see is a message like this "Template "file_path" is not defined."

this function is very usefull to me, Tks for ur reading.

@crazydeath137
Copy link
Author

crazydeath137 commented Dec 10, 2018

my solution to include raw file is create a new function.

`

functions:[
{
name: "include_raw",
func: function (path) {
var content = 'content';
content = fs.readFileSync('app/'+path).toString();
return content;
}
}
]

`

and use it
`

{{ include_raw('haha.html') }}

`

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

1 participant