Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Last active February 16, 2017 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpablocs/3247ade3ddb360351366758845642829 to your computer and use it in GitHub Desktop.
Save juanpablocs/3247ade3ddb360351366758845642829 to your computer and use it in GitHub Desktop.
replace static file and add timestamp for cached in layout html
sed -ri \"s/myjs\.js([^\"]+|)\"/min.js?$(date +%s)\"/g" ./mylayout.twig
#replace this
<script src="/myjs.js"></script>
or
<script src="/myjs.js?1487206735"></script>
with this
<script src="/myjs.js?2348392493284932"></script>
{
"name": "My Site",
"version": "1.0.0",
"description": "test",
"scripts": {
"js":"NODE_ENV=production webpack -p",
"postjs":"sed -ri \"s/myjs\\.js([^\\\"]+|)\\\"/myjs.js?$(date +%s)\\\"/g\" ./mylayout.twig",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment