hexojs / hexo-asset-pipeline

A hexo plugin to minify/optimize HTML, CSS, JS and images. Supports revisioning of assets.
29 stars 16 forks source link

html的css/js url并没有替换是什么问题 #19

Open think2cat opened 6 years ago

think2cat commented 6 years ago

js文件名都替换成index-ff3aa84bc13ec2a839abcd03494d77a3.js这种形式了,但是html里面依然是index-v1.1.js这种,导致载入失败 配置是默认的,哪里的问题呢

asset_pipeline:
  revisioning:
    enable: true
  clean_css:
    enable: true
  uglify_js:
    enable: true
  imagemin:
    enable: true
  html_minifier:
    enable: true
bhaskarmelkani commented 6 years ago

Hey,

Can you provide some details, like the <script> tag that you have written or something ?

think2cat commented 6 years ago
  1. install the plugin npm i hexo-asset-pipeline --save
  2. add config into _config.yml
    asset_pipeline:
    revisioning:
    enable: true
    clean_css:
    enable: true
    uglify_js:
    enable: true
    imagemin:
    enable: true
    html_minifier:
    enable: true
  3. make html
    hexo g
  4. in /public/index.html
    <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
    <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">
    <link href="/css/main.css?v=6.2.0" rel="stylesheet" type="text/css">

    /public/css/ main-7b42bda0273d35060b1186bb63dfd0e2.css /public/js/ nothing~ /public/js/src/ affix-50f6035659047ce54d49eeee3341f4ae.js algolia-search-d67f2db13718b162ebb08aa50d4b3abe.js bootstrap-30297caa96a35997f3461792183bbab7.js exturl-6ec3042c8eb7c6c5ce2e6bf976f48682.js js.cookie-2c695c446cf690eb838d21b6b683c391.js motion-2246400751889785fc7a37502181f634.js post-details-dcbb59ef5172f8cc9c21f673a8e4caf7.js schemes scroll-cookie-5c7e8a8bf797b8330840e0e20ff67f08.js scrollspy-3df7e0e2baee294ac66f613f8f08e9d0.js utils-29cac7c18691af5865c30f660cdd8ae0.js /public/lib/pace/ affix-50f6035659047ce54d49eeee3341f4ae.js algolia-search-d67f2db13718b162ebb08aa50d4b3abe.js bootstrap-30297caa96a35997f3461792183bbab7.js exturl-6ec3042c8eb7c6c5ce2e6bf976f48682.js js.cookie-2c695c446cf690eb838d21b6b683c391.js motion-2246400751889785fc7a37502181f634.js post-details-dcbb59ef5172f8cc9c21f673a8e4caf7.js schemes scroll-cookie-5c7e8a8bf797b8330840e0e20ff67f08.js scrollspy-3df7e0e2baee294ac66f613f8f08e9d0.js utils-29cac7c18691af5865c30f660cdd8ae0.js

bhaskarmelkani commented 6 years ago

Hey,

Thanks for your reply. :)

I guess I got the issue, it is happening due to ?v=1.0.2 the version in the src of script.

I will check it again and get back ASAP, will also fix it.

think2cat commented 6 years ago

Thanks very much ! 👍