Skip to content

Commit

Permalink
feat: add support cache busting
Browse files Browse the repository at this point in the history
  • Loading branch information
talha131 committed Feb 3, 2020
1 parent 2ff79ee commit cde0dc5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,18 @@ const watchFiles = () => {
"static/**/*.js",
"!static/**/bootstrap.css",
"!static/**/bootstrap_responsive.css",
"!static/**/elegant.prod.css",
"!static/js/elegant.prod.js"
"!static/**/elegant.prod.e4bd582858.css",
"!static/js/elegant.prod.e4bd582858.js"
],
{ ignoreInitial: false },
buildAll
);
};

const pathProdCSS = path.join(__dirname, "static/css/elegant.prod.css");
const pathProdCSS = path.join(
__dirname,
"static/css/elegant.prod.e4bd582858.css"
);
const rmProdCSS = cb => {
if (fs.existsSync(pathProdCSS)) {
fs.unlinkSync(pathProdCSS);
Expand All @@ -93,9 +96,9 @@ const minifyJS = () => {
"static/clipboard/clipboard.js",
"static/js/copy-to-clipboard.js",
"static/js/lunr-search-result.js",
"!static/js/elegant.prod.js"
"!static/js/elegant.prod.e4bd582858.js"
])
.pipe(concat("elegant.prod.js"))
.pipe(concat("elegant.prod.e4bd582858.js"))
.pipe(terser())
.pipe(dest("static/js/"));
};
Expand All @@ -113,10 +116,10 @@ const compileCSS = () => {
"static/photoswipe/photoswipe.css",
"static/photoswipe/default-skin/default-skin.css",
"static/css/*.css",
"!static/css/elegant.prod.css"
"!static/css/elegant.prod.e4bd582858.css"
])
.pipe(postcss(plugins))
.pipe(concat("elegant.prod.css"))
.pipe(concat("elegant.prod.e4bd582858.css"))
.pipe(dest("static/css/"));
};

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{% if 'assets' in PLUGINS %}
{% include '_includes/minify_css.html' with context %}
{% else %}
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/elegant.prod.css" media="screen">
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/elegant.prod.e4bd582858.css" media="screen">
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/custom.css" media="screen">
{% endif %}
{% endblock head_links %}
Expand Down Expand Up @@ -107,7 +107,7 @@
{% endif %}
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="{{ SITEURL }}/theme/js/elegant.prod.js"></script>
<script src="{{ SITEURL }}/theme/js/elegant.prod.e4bd582858.js"></script>
<script>
function validateForm(query)
{
Expand Down

0 comments on commit cde0dc5

Please sign in to comment.