@ruby2js/rollup-plugin

    0.0.2 • Public • Published

    @ruby2js/rollup-plugin

    Integration between Rollup and Ruby2JS

    Installation

    npm install --save-dev @ruby2js/rollup-plugin
    # or
    yarn add -D @ruby2js/rollup-plugin

    Usage (basic)

    // rollup.config.js
    import ruby2js from '@ruby2js/rollup-plugin';
    
    export default {
      input: 'index.js.rb',
    
      output: {
        file: 'bundle.js',
        format: 'iife'
      },
    
      plugins: [
        ruby2js({
          eslevel: 2021,
          filters: ['esm', 'functions']
        })
      ]
    }

    Usage (lit-element)

    // rollup.config.js
    import { nodeResolve } from '@rollup/plugin-node-resolve';
    import ruby2js from '@ruby2js/rollup-plugin';
    
    export default {
      input: 'index.js.rb',
    
      output: {
        file: 'bundle.js',
        format: 'iife'
      },
    
      plugins: [
        nodeResolve(),
    
        ruby2js({
          eslevel: 2021,
          filters: ['lit-element', 'esm', 'functions']
        })
      ]
    }

    Usage (react)

    // rollup.config.js
    import { nodeResolve } from '@rollup/plugin-node-resolve';
    import commonjs from '@rollup/plugin-commonjs';
    import replace from '@rollup/plugin-replace';
    import ruby2js from '@ruby2js/rollup-plugin';
    
    const env = process.env.NODE_ENV || 'development';
    
    export default {
      input: 'index.js.rb',
    
      output: {
        file: 'bundle.js',
        format: 'iife'
      },
    
      plugins: [
        nodeResolve(),
    
        commonjs(),
    
        replace({
          preventAssignment: true,
          values: {
            'process.env.NODE_ENV': JSON.stringify(env)
          }
        }),
    
        ruby2js({
          eslevel: 2021,
          filters: ['react', 'esm', 'functions']
        })
      ]
    }

    Usage (stimulus)

    import { nodeResolve } from '@rollup/plugin-node-resolve';
    import ruby2js from '@ruby2js/rollup-plugin';
    
    export default {
      input: 'index.js.rb',
    
      output: {
        file: 'bundle.js',
        format: 'iife'
      },
    
      context: 'window',
    
      plugins: [
        nodeResolve(),
    
        ruby2js({
          eslevel: 2021,
          filters: ['stimulus', 'esm', 'functions']
        })
      ]
    }

    Keywords

    none

    Install

    npm i @ruby2js/rollup-plugin

    DownloadsWeekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    2.87 kB

    Total Files

    4

    Last publish

    Collaborators

    • rubys
    • jaredwhite