Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/njzjz/hexo-tag-injector
Inject scripts or stylesheets only for posts with tags.
https://github.com/njzjz/hexo-tag-injector
Last synced: about 1 month ago
JSON representation
Inject scripts or stylesheets only for posts with tags.
- Host: GitHub
- URL: https://github.com/njzjz/hexo-tag-injector
- Owner: njzjz
- Created: 2021-02-14T23:51:44.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-11T01:46:54.000Z (over 3 years ago)
- Last Synced: 2024-10-13T16:47:07.109Z (2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hexo-tag-injector
Inject scripts or stylesheets only for posts with tags.
## Usage
```js
const css = hexo.extend.helper.get('css').bind(hexo);
const Injector = require("hexo-tag-injector")
const injector = new Injector(hexo);
hexo.extend.tag.register("some-tag", function(args){
var content = some_func();
return injector.mark(content);
}
injector.register("head_end", css("css/some_stylesheet.min.css"));
```