This repository was archived by the owner on Dec 29, 2022. It is now read-only.
bookmarkletify 0.0.5
Install from the command line:
Learn more about npm packages
$ npm install @neos21/bookmarkletify@0.0.5
Install via package.json:
"@neos21/bookmarkletify": "0.0.5"
About this version
JavaScript コードを Bookmarklet 形式に圧縮・変換します。
$ npm install -g @neos21/bookmarkletify
# Input From File
$ bookmarkletify -i ./my-file.js
$ bookmarkletify --input ./my-file.js
# Input From Arguments
$ bookmarkletify "console.log('Test');"
javascript:(()=>{console.log("Test")})();
# Example Output
// CJS
const bookmarkletify = require('@neos21/bookmarkletify');
// ESM
import { bookmarkletify } from '@neos21/bookmarkletify';
const input = `javascript:
((doc) => {
let elem = doc.querySelector('#test');
if(elem) {
console.log(elem.value);
}
})(document);
`;
try {
const uglified = bookmarkletify(input);
console.log(uglified);
}
catch(error) {
console.error(error);
}