menu
White logo

Webpack Installation

Add this line to your application's package.json:

"dependencies": {
  "n2-styles": "github:n2publishing/n2-styles"
}

And then execute:

$ yarn install

And then execute one more cmd to add additional required packages:

$ yarn add jquery hammerjs node-waves prop-types selectize tether

Update your environments.js:

const { environment } = require('@rails/webpacker')

const webpack = require('webpack');

environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
  $: 'jquery',
  jQuery: 'jquery',
  "window.jQuery": "jquery",
  Tether: 'tether',
  Selectize: 'selectize',
  Waves: 'node-waves'
}));

module.exports = environment

Add to stylesheets.scss:

@import "~n2-styles/dist/scss/n2_styles";

Add to your application.js:

import N2Styles from 'n2-styles/dist/js/n2-styles.min';
import 'n2-styles/dist/js/vendors.min';