You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.
I'm unable to include a file from within a template, similar to #96.
I'm new to SAO and EJS and I'm not sure if this is the correct usage, but I didn't find anything related to it in the documentation. To reproduce it I created a new generator: npx sao generator sao-name npx sao --version
sao/1.7.1 win32-x64 node-v12.16.3
I added code like <% include file %>, <%- include file %>, or <% include file.txt %> to template/README.md, and then created a file template/file.txt.
Running npx sao . results in
error Error: Could not find the include file "file"
at getIncludePath (C:\ProjectsExternal\sao-name\node_modules\ejs\lib\ejs.js:165:13)
at includeSource (C:\ProjectsExternal\sao-name\node_modules\ejs\lib\ejs.js:309:17)
at C:\ProjectsExternal\sao-name\node_modules\ejs\lib\ejs.js:745:26
at Array.forEach (<anonymous>)
at Template.generateSource (C:\ProjectsExternal\sao-name\node_modules\ejs\lib\ejs.js:721:15)
at Template.compile (C:\ProjectsExternal\sao-name\node_modules\ejs\lib\ejs.js:574:12)
at Object.compile (C:\ProjectsExternal\sao-name\node_modules\ejs\lib\ejs.js:392:16)
at Transformer.render (C:\ProjectsExternal\sao-name\node_modules\jstransformer\index.js:288:44)
at C:\ProjectsExternal\sao-name\node_modules\sao\lib\runActions.js:69:27
at Array.forEach (<anonymous>)
I was also unable to use this as part of https://github.com/nuxt/create-nuxt-app generator, where I had a use-case of duplicating contents of one file to another. I originally wanted to use something like a copy action, but it seems there is no such thing available based on https://sao.vercel.app/saofile.html#actions (note: please add this link to https://sao.vercel.app/guide/creating-generators.html#folder-structure because it's almost impossible to find). If this use-case is supported using some workaround (except hard-coding fs usage in completed section, as mentioned by #126), please mention some example in the docs.
When debugging the issue, options at https://github.com/mde/ejs/blob/576283bb5db2f5b6d2c9f979163a84644f581697/lib/ejs.js#L174 has the value of {"client":false,"compileDebug":true,"debug":false,"openDelimiter":"<","closeDelimiter":">","delimiter":"%","strict":false,"cache":false,"localsName":"locals","legacyInclude":true,"_with":true}, and so because it's missing filename field, it isn't resolved using a relative path.
The text was updated successfully, but these errors were encountered:
I'm unable to include a file from within a template, similar to #96.
I'm new to SAO and EJS and I'm not sure if this is the correct usage, but I didn't find anything related to it in the documentation. To reproduce it I created a new generator:
npx sao generator sao-name
npx sao --version
I added code like
<% include file %>
,<%- include file %>
, or<% include file.txt %>
to template/README.md
, and then created a file template/file.txt
.Running
npx sao .
results inI was also unable to use this as part of https://github.com/nuxt/create-nuxt-app generator, where I had a use-case of duplicating contents of one file to another. I originally wanted to use something like a
copy
action, but it seems there is no such thing available based on https://sao.vercel.app/saofile.html#actions (note: please add this link to https://sao.vercel.app/guide/creating-generators.html#folder-structure because it's almost impossible to find). If this use-case is supported using some workaround (except hard-codingfs
usage in completed section, as mentioned by #126), please mention some example in the docs.When debugging the issue,
options
at https://github.com/mde/ejs/blob/576283bb5db2f5b6d2c9f979163a84644f581697/lib/ejs.js#L174 has the value of{"client":false,"compileDebug":true,"debug":false,"openDelimiter":"<","closeDelimiter":">","delimiter":"%","strict":false,"cache":false,"localsName":"locals","legacyInclude":true,"_with":true}
, and so because it's missingfilename
field, it isn't resolved using a relative path.The text was updated successfully, but these errors were encountered: