How to use @ephox/swag - 10 common examples

To help you get started, we’ve selected a few @ephox/swag 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 tinymce / tinymce / tools / modules / plugin-grunt.js View on Github external
const jsPluginDestFile = 'dist/' + name + '/plugin.js';
  const jsPluginDestFileMin = 'dist/' + name + '/plugin.min.js';
  const tsDemoSourceFile = path.resolve('src/demo/ts/demo/Demo.ts');
  const jsDemoDestFile = path.resolve('scratch/compiled/demo.js');
  const scratchDir = path.resolve(__dirname, '../../scratch');

  var config = {
    rollup: {
      options: {
        treeshake: true,
        moduleName: name,
        format: 'iife',
        banner: '(function () {',
        footer: '})()',
        plugins: [
          swag.nodeResolve({
            basedir: __dirname,
            prefixes: {
              'tinymce/core': '../../lib/globals/tinymce/core'
            }
          }),
          swag.remapImports()
        ]
      },
      plugin: {
        files:[
          {
            src: `../../../lib/plugins/${name}/src/main/ts/Plugin.js`,
            dest: jsPluginDestFile
          }
        ]
      }
github tinymce / tinymce / tools / modules / theme-grunt.js View on Github external
const rootPath = '../../../';
  const jsThemeDestFile = 'dist/' + name + '/theme.js';
  const jsThemeDestFileMin = 'dist/' + name + '/theme.min.js';
  const tsDemoSourceFile = path.resolve('src/demo/ts/demo/Demos.ts');
  const jsDemoDestFile = path.resolve('scratch/compiled/demo.js');

  var config = {
    rollup: {
      options: {
        treeshake: true,
        moduleName: name,
        format: 'iife',
        banner: '(function () {',
        footer: '})()',
        plugins: [
          swag.nodeResolve({
            basedir: __dirname,
            prefixes: {
              'tinymce/core': '../../lib/globals/tinymce/core',
              'tinymce/ui': '../../lib/ui/src/main/ts'
            }
          }),
          swag.remapImports()
        ]
      },
      theme: {
        files:[
          {
            src: `../../../lib/themes/${name}/src/main/ts/Theme.js`,
            dest: jsThemeDestFile
          }
        ]
github tinymce / tinymce / modules / tinymce / Gruntfile.js View on Github external
options: {
        configFile: 'src/core/main/json/globals.json',
        outputDir: 'lib/globals',
        templateFile: 'src/core/main/js/GlobalsTemplate.js'
      }
    },

    rollup: Object.assign(
      {
        core: {
          options: {
            treeshake: true,
            format: 'iife',
            onwarn: swag.onwarn,
            plugins: [
              swag.nodeResolve({
                basedir: __dirname,
                prefixes: {
                  'tinymce/core': 'lib/core/main/ts'
                }
              }),
              swag.remapImports()
            ]
          },
          files:[
            {
              src: 'lib/core/main/ts/api/Main.js',
              dest: 'js/tinymce/tinymce.js'
            }
          ]
        }
      },
github tinymce / tinymce / src / core / Gruntfile.js View on Github external
const scratchDir = path.resolve(__dirname, '../../scratch');
  const tsConfigPath = path.resolve(__dirname, '../../tsconfig.json');
  const tsDemoSourceFile = path.resolve('src/demo/ts/demo/Demos.ts');
  const jsDemoDestFile = path.resolve('scratch/compiled/demo.js');
  const rootPath = '../../';

  grunt.initConfig({
    rollup: {
      options: {
        treeshake: true,
        moduleName: 'tinymce',
        format: 'iife',
        banner: '(function () {',
        footer: '})()',
        plugins: [
          swag.nodeResolve({
            basedir: __dirname,
            prefixes: {
              'tinymce/core': '../../src/core/dist/globals/tinymce/core',
              'tinymce/ui': '../../lib/ui/main/ts'
            }
          }),
          swag.remapImports()
        ]
      },
      core: {
        files:[
          {
            src: '../../lib/core/src/main/ts/api/Main.js',
            dest: 'dist/tinymce/tinymce.js'
          }
        ]
github tinymce / tinymce / modules / tinymce / Gruntfile.js View on Github external
format: 'iife',
            onwarn: swag.onwarn,
            plugins: [
              swag.nodeResolve({
                basedir: __dirname,
                prefixes: gruntUtils.prefixes({
                  'tinymce/core': 'lib/globals/tinymce/core'
                }, [
                  [`tinymce/plugins/${name}`, `lib/plugins/${name}/main/ts`]
                ]),
                mappers: [
                  swag.mappers.replaceDir('./lib/core/main/ts/api', './lib/globals/tinymce/core/api'),
                  swag.mappers.invalidDir('./lib/core/main/ts')
                ]
              }),
              swag.remapImports()
            ]
          },
          files:[ { src: `lib/plugins/${name}/main/ts/Main.js`, dest: `js/tinymce/plugins/${name}/plugin.js` } ]
        };
      }),
      gruntUtils.generate(themes, 'theme', (name) => {
github tinymce / tinymce / tools / modules / plugin-grunt.js View on Github external
var config = {
    rollup: {
      options: {
        treeshake: true,
        moduleName: name,
        format: 'iife',
        banner: '(function () {',
        footer: '})()',
        plugins: [
          swag.nodeResolve({
            basedir: __dirname,
            prefixes: {
              'tinymce/core': '../../lib/globals/tinymce/core'
            }
          }),
          swag.remapImports()
        ]
      },
      plugin: {
        files:[
          {
            src: `../../../lib/plugins/${name}/src/main/ts/Plugin.js`,
            dest: jsPluginDestFile
          }
        ]
      }
    },

    uglify: {
      options: {
        output: {
          ascii_only: true
github tinymce / tinymce / tools / modules / theme-grunt.js View on Github external
rollup: {
      options: {
        treeshake: true,
        moduleName: name,
        format: 'iife',
        banner: '(function () {',
        footer: '})()',
        plugins: [
          swag.nodeResolve({
            basedir: __dirname,
            prefixes: {
              'tinymce/core': '../../lib/globals/tinymce/core',
              'tinymce/ui': '../../lib/ui/src/main/ts'
            }
          }),
          swag.remapImports()
        ]
      },
      theme: {
        files:[
          {
            src: `../../../lib/themes/${name}/src/main/ts/Theme.js`,
            dest: jsThemeDestFile
          }
        ]
      }
    },

    uglify: {
      options: {
        output: {
          ascii_only: true
github tinymce / tinymce / src / core / Gruntfile.js View on Github external
rollup: {
      options: {
        treeshake: true,
        moduleName: 'tinymce',
        format: 'iife',
        banner: '(function () {',
        footer: '})()',
        plugins: [
          swag.nodeResolve({
            basedir: __dirname,
            prefixes: {
              'tinymce/core': '../../src/core/dist/globals/tinymce/core',
              'tinymce/ui': '../../lib/ui/main/ts'
            }
          }),
          swag.remapImports()
        ]
      },
      core: {
        files:[
          {
            src: '../../lib/core/src/main/ts/api/Main.js',
            dest: 'dist/tinymce/tinymce.js'
          }
        ]
      }
    },

    uglify: {
      options: {
        output: {
          ascii_only: true,
github tinymce / tinymce / modules / tinymce / Gruntfile.js View on Github external
return {
          options: {
            treeshake: true,
            format: 'iife',
            onwarn: swag.onwarn,
            plugins: [
              swag.nodeResolve({
                basedir: __dirname,
                prefixes: gruntUtils.prefixes({
                  'tinymce/core': 'lib/globals/tinymce/core',
                  'tinymce/ui': 'lib/ui/main/ts'
                }, [
                  [`tinymce/themes/${name}`, `lib/themes/${name}/main/ts`]
                ]),
                mappers: [
                  swag.mappers.replaceDir('./lib/core/main/ts/api', './lib/globals/tinymce/core/api'),
                  swag.mappers.invalidDir('./lib/core/main/ts')
                ]
              }),
              swag.remapImports()
            ]
          },
          files:[
            {
              src: `lib/themes/${name}/main/ts/Main.js`,
              dest: `js/tinymce/themes/${name}/theme.js`
            }
          ]
        };
      })
    ),
github tinymce / tinymce / modules / tinymce / Gruntfile.js View on Github external
gruntUtils.generate(plugins, 'plugin', (name) => {
        return {
          options: {
            treeshake: true,
            format: 'iife',
            onwarn: swag.onwarn,
            plugins: [
              swag.nodeResolve({
                basedir: __dirname,
                prefixes: gruntUtils.prefixes({
                  'tinymce/core': 'lib/globals/tinymce/core'
                }, [
                  [`tinymce/plugins/${name}`, `lib/plugins/${name}/main/ts`]
                ]),
                mappers: [
                  swag.mappers.replaceDir('./lib/core/main/ts/api', './lib/globals/tinymce/core/api'),
                  swag.mappers.invalidDir('./lib/core/main/ts')
                ]
              }),
              swag.remapImports()
            ]
          },
          files:[ { src: `lib/plugins/${name}/main/ts/Main.js`, dest: `js/tinymce/plugins/${name}/plugin.js` } ]
        };
      }),
      gruntUtils.generate(themes, 'theme', (name) => {

@ephox/swag

A collection of tools for rollup/webpack

Apache-2.0
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages