How to use the posthtml/package.json.homepage function in posthtml

To help you get started, we’ve selected a few posthtml 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 fkling / astexplorer / website / src / parsers / html / transformers / posthtml / index.js View on Github external
import compileModule from '../../../utils/compileModule';
import pkg from 'posthtml/package.json';

const ID = 'posthtml';

export default {
  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage || 'https://github.com/posthtml/posthtml',

  defaultParserID: 'posthtml-parser',

  loadTransformer(callback) {
    require(['../../../transpilers/babel', 'posthtml'], (transpile, posthtml) =>
      callback({ transpile: transpile.default, posthtml }));
  },

  transform({ transpile, posthtml }, transformCode, code) {
    // transpile with babel for es6+ support
    transformCode = transpile(transformCode);
    // compile to turn from string into a module
    let transform = compileModule(
      // eslint-disable-line no-shadow
      transformCode,
    );