1.2.0 • Published 10 months ago
bocchi v1.2.0
bocchi
A cli build tool for userscript
Install
# npm
npm i bocchi -D
# yarn
yarn add bocchi -D
# pnpm
pnpm i bocchi -DCreate with template
# npm
npm create bocchi-app <name>
# yarn
yarn create bocchi-app <name>
# pnpm
pnpm create bocchi-app <name>Usage
- create
meta.template
// ==UserScript==
// @name
// @namespace #homepage#
// @version #version#
// @description #description#
// @author
// @match https://example.com/*
// @grant none
// @downloadURL
// @updateURL
// ==/UserScript==- write entry
src/index.(j|t)s - add scripts to
package.json
{
"scripts": {
"dev": "bocchi dev",
"build": "bocchi build"
}
}npm run devfor development,npm run buildfor bundle production
Feature
package.jsonsupport rollupglobals
{
"globals": {
"lodash": "window._"
}
}- support
[name].template.html
<!-- file: [name].template.html -->
<template id="tmpId">
<span>1</span>
</template>
<a id="anchorId"></a>// file: index.js
import tmp from './[name].template.html'
console.log(tmp.tmpId) //=> <template id="tmpId">\n <span>1</span>\n</template>
console.log(tmp.anchorId) //=> <a id="anchorId"></a>- auto load
postcss.config.js