How to use the vue-inbrowser-compiler.addScopedStyle function in vue-inbrowser-compiler

To help you get started, we’ve selected a few vue-inbrowser-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vue-styleguidist / vue-live / src / Preview.vue View on Github external
if (renderedComponent.template) {
          // if this is a pure template or if we are in hybrid vsg mode,
          // we need to set the template up.
          data.template = `<div>${renderedComponent.template}</div>`;
        }
      } catch (e) {
        this.handleError(e);
        return;
      }

      data.components = this.components;
      if (style) {
        // To add the scope id attribute to each item in the html
        // this way when we add the scoped style sheet it will be aplied
        data._scopeId = `data-${this.scope}`;
        addScopedStyle(style, this.scope);
      }

      if (data.template || data.render) {
        this.previewedComponent = data;
      } else {
        this.handleError({
          message:
            "[Vue Live] no template or render function specified, you might have an issue in your example"
        });
      }
    }
  }

vue-inbrowser-compiler

compile vue single file components right in your browser

MIT
Latest version published 12 months ago

Package Health Score

86 / 100
Full package analysis