Skip to content

jamespan/hexo-filter-asset-inline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-filter-asset-inline

npm npm Build Status NPM Dependencies Coverage Status

Inline remote and local asset files when generate site. Supports CSS and JS files.

Instalation

To install hexo-filter-asset-inline run:

npm install hexo-filter-asset-inline --save

Usage

Append __inline=true to the URL or relative path of asset file. Make sure __inline=true is at the end of path or URL.

Examples:

For local css with relative path.

<link rel="stylesheet" type="text/css" href="/css/a.css?__inline=true"><!--will be inlined-->
<link rel="stylesheet" type="text/css" href="/css/a.css"><!--will not inlined-->
<link rel="stylesheet" type="text/css" href="/css/a.css?__inline=false"><!--will not inlined-->

For remote css with URL.

<link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/highlight.js/8.4/styles/github.min.css?__inline=true"><!--will be inlined-->
<link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/highlight.js/8.4/styles/github.min.css"><!--will not inlined-->
<link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/highlight.js/8.4/styles/github.min.css?__inline=false"><!--will not inlined-->

For local js with relative path.

<script type="text/javascript" src="/js/a.js?__inline=true"></script><!--will be inlined-->
<script type="text/javascript" src="/js/a.js"></script><!--will not inlined-->
<script type="text/javascript" src="/js/a.js?__inline=false"></script><!--will not inlined-->

For remote js with URL.

<script type="text/javascript" src="//cdn.bootcss.com/highlight.js/8.9.1/highlight.min.js?__inline=true"></script><!--will be inlined-->
<script type="text/javascript" src="//cdn.bootcss.com/highlight.js/8.9.1/highlight.min.js"></script><!--will not inlined-->
<script type="text/javascript" src="//cdn.bootcss.com/highlight.js/8.9.1/highlight.min.js?__inline=false"></script><!--will not inlined-->

Known Issue

  • not support font-awesome css
  • not support web font css

About

inline css and js files on generate site

Resources

License

Stars

Watchers

Forks

Packages

No packages published