This package is looking for a new maintainer! Please let us know in the community GitHub Discussions if you'd like to contribute.
Integration between Rollup and Ruby2JS
npm install --save-dev @ruby2js/rollup-plugin
# or
yarn add -D @ruby2js/rollup-plugin
- Visit ruby2js.com for detailed instructions and examples.
- See Ruby2JS Options docs for a list of available options.
Below are some example configurations using some popular libraries. Other than the differences in filters, the differences are to make the library themselves work with rollup.
// 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']
})
]
}
// 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']
})
]
}
// 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']
})
]
}
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']
})
]
}
git clone https://github.com/ruby2js/ruby2js.git
cd ruby2js/packages/rollup-plugin
yarn install
yarn test
- Fork it (https://github.com/ruby2js/ruby2js/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
MIT