Collection of useful functions for AB Tasty Widgets.
Collection of useful functions for AB Tasty Widgets.
Inside your Widget folder, install the widget-utils library:
``bash`
npm install @abtasty/widget-utils
_Note: you can also use yarn instead of npm_: yarn add @abtasty/widget-utils
With Webpack or Rollup.js:
`javascript
import { waitForElement, isAffected } from '@abtasty/widget-utils';
const waitForBody = waitForElement('#section', (section) => {
section.insertAdjacentHTML('beforeend', '
New paragraph at the end of that section.
');setTimeout(() => {
if (!isAffected()) {
waitForBody.clear();
}
}, 10000);
`
When you have installed and build your locally project :
1. run in a terminal : npm link in your widget-utils foldernpm link @abtasty/widget-utils
2. in your widget local folder you want to test this project, run in a terminal : editor
3. build your widget project, then build project.
First, install your widget-utils, copy the path of the project.
Then, In your local widget project :
- after a npm install, delete the folder /node_modules/@abtasty/widget-utils/node_modules/@abtasty/
- with your terminal, navigate to the folder
- run the bash command :
`bash`
ln -s {your path to widget-utils project folder} widget-utils
A symlink has been created in your widget project, with the folder: /node_modules/@abtasty/widget-utils
The fonts.js file in this repo is exposing the Google Fonts from ABTasty CDN (which is populated by this repo:
Any changes in the common-fonts repo must follow the font regeneration here.
To regenerate the fonts.js file,
- run the following command in the root of this repo:
`sh`
yarn run generateFonts
- And commit the file
- Create the merge request
- Seek at least one approval from fellow _frontend developers_ or _nautilus_ team
- Merge the MR
Once the MR is approved, follow the following steps:
- Release this repo on npm with npm publish`
- Merge the repo