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

An options for specifing file name in code to replace #24

Open
xileftenurb opened this issue Apr 26, 2019 · 3 comments
Open

An options for specifing file name in code to replace #24

xileftenurb opened this issue Apr 26, 2019 · 3 comments

Comments

@xileftenurb
Copy link

hi,

I would like to be able to tell the name of the file to replace version number in my html who do not match the name on the filesystem.

the reason is that I create the file name from a variable.
so in my html the tag (using EJS) is like

<link rel="stylesheet" href="/release/<%=shortname%>.min.css" type="text/css">
<script src="/release/<%=shortname%>.min.js"></script>

and I use the same variable to create the path name I send to node-version-assets (via grunt)
like "public/release/" + shortName + ".min.js"

the file real name is defined by the variable.

Is there a ways to achieve this?

thank you

@techjacker
Copy link
Owner

Yes it could work but you'd need to share the variable value somehow, eg define it in a JSON file and include that before running the grunt script and EJS.

@xileftenurb
Copy link
Author

I already do that,
The problem is to tell "node-version-assets" to version files named mycoolwebsite.min.js and mycoolwebsite.min.css and to change it's name in my ejs where it is writed as "<%=shortname%>.min.js" and "<%=shortname%>.min.css".

how can I specify two different name, one for the real file and one for the file as writed in the ejs?

@techjacker
Copy link
Owner

You'd need to write the output of the renaming into a JSON file and then feed that to your EJS template. Currently the file renames are just written to stdout, see:
https://github.com/techjacker/node-version-assets/blob/master/lib/main.js#L242

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

2 participants