Merge branch 'smart-autoinit'
https://codeberg.org/kytta/shareon/pulls/2
This commit is contained in:
commit
3226d8442d
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -6,10 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- **BREAKING:** new (auto-)init behaviour, inspired by [petite-vue](https://github.com/vuejs/petite-vue)
|
||||||
|
- `require`, `import`, or use `<script>` to include Shareon without
|
||||||
|
initialization
|
||||||
|
- use exported `initializeShareon` function in Node to initialize Shareon
|
||||||
|
- use `init` attribute in `script` to initialize Shareon in-browser
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="path/to/shareon.js" init>
|
||||||
|
```
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- **BREAKING:** default version of the package doesn't auto-initialize buttons
|
||||||
- change code style to [Prettier](https://prettier.io/)
|
- change code style to [Prettier](https://prettier.io/)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- **BREAKING:** `noinit` version of the package is removed
|
||||||
|
|
||||||
## [1.6.3] - 2022-02-02
|
## [1.6.3] - 2022-02-02
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -200,7 +217,7 @@ Initial release of shareon
|
||||||
- Add Telegram button
|
- Add Telegram button
|
||||||
- Add Twitter button
|
- Add Twitter button
|
||||||
|
|
||||||
[Unreleased]: https://codeberg.org/kytta/shareon/compare/v1.6.3...main
|
[unreleased]: https://codeberg.org/kytta/shareon/compare/v1.6.3...main
|
||||||
[1.6.2]: https://github.com/kytta/shareon/compare/v1.6.2...v1.6.3
|
[1.6.2]: https://github.com/kytta/shareon/compare/v1.6.2...v1.6.3
|
||||||
[1.6.2]: https://github.com/kytta/shareon/compare/v1.6.1...v1.6.2
|
[1.6.2]: https://github.com/kytta/shareon/compare/v1.6.1...v1.6.2
|
||||||
[1.6.1]: https://github.com/kytta/shareon/compare/v1.6.0...v1.6.1
|
[1.6.1]: https://github.com/kytta/shareon/compare/v1.6.0...v1.6.1
|
||||||
|
|
|
@ -99,15 +99,8 @@ const getOutput = (baseDir) => {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
input: join(__dirname, "src", "index.js"),
|
||||||
input: join(__dirname, "src", "autoinit.js"),
|
|
||||||
output: getOutput(outputDir),
|
output: getOutput(outputDir),
|
||||||
plugins: getPlugins(true),
|
plugins: getPlugins(true),
|
||||||
},
|
};
|
||||||
{
|
|
||||||
input: join(__dirname, "src", "shareon.js"),
|
|
||||||
output: getOutput(join(outputDir, "noinit")),
|
|
||||||
plugins: getPlugins(false),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import initializeShareon from "./shareon";
|
import initializeShareon from "./shareon";
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
|
||||||
window.onload = () => {
|
// TODO: update README
|
||||||
|
const s = document.currentScript;
|
||||||
|
if (s && s.hasAttribute("init")) {
|
||||||
initializeShareon();
|
initializeShareon();
|
||||||
};
|
}
|
||||||
|
|
||||||
export default initializeShareon;
|
export default initializeShareon;
|
Loading…
Reference in New Issue