Prettier
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import nunjucks from 'nunjucks';
|
||||
|
||||
const babelPluginNunjucks = ({types: t}) => {
|
||||
const babelPluginNunjucks = ({ types: t }) => {
|
||||
return {
|
||||
pre(state) {
|
||||
const options = state.opts.plugins[0].options;
|
||||
this.njkenv = new nunjucks.Environment(new nunjucks.FileSystemLoader(options.templatesFolder));
|
||||
if (options.globals) {
|
||||
for (const {name, value} of options.globals) {
|
||||
for (const { name, value } of options.globals) {
|
||||
this.njkenv.addGlobal(name, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
visitor: {
|
||||
TaggedTemplateExpression(path) {
|
||||
if (path.get('tag').isIdentifier({name: 'njk'})) {
|
||||
if (path.get('tag').isIdentifier({ name: 'njk' })) {
|
||||
const render = this.njkenv.renderString(path.node.quasi.quasis[0].value.raw);
|
||||
path.replaceWith(t.stringLiteral(render));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ await scrollTo(document.querySelector('#example'), 10);
|
||||
## Параметры
|
||||
|
||||
| Параметр | Тип | По умолчанию | Описание |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| :------------- | :------------ | :----------- | :------------------------------------------------------------------------- |
|
||||
| **$el** | `HTMLElement` | — | DOM-элемент, к которому нужно прокрутить страницу |
|
||||
| **offset** | `number` | `0` | Величина отступа сверху от целевого элемента |
|
||||
| **offsetInPx** | `boolean` | `false` | Тип отступа: `true` — в пикселях, `false` — в процентах от высоты вьюпорта |
|
||||
|
||||
Reference in New Issue
Block a user