1.3.0 • Published 2 years ago

tredux-material-updated v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Tredux-material

Tredux + Material.ui + React-route + React + Shim

Usage

  • clone tredux-material-example
  • npm install
  • npm run local

Main project configuration required, or that can be overridden.

  • src/config/{environment}.js
  • src/config/theme.js
  • src/modules/root - the root module
  • src/modules/root/containers/Header.jsx - the header
  • src/modules/root/containers/Menu.jsx - the menu
  • src/modules/root/containers/Submenu.jsx - the submenu
  • src/index.js

This project is hotwired to work with webpack

So, in your webpack.config.js, you must include

const path = require('path'),
  webpack = require('webpack'),
  ExtractTextPlugin = require("extract-text-webpack-plugin"),
  LiveReloadPlugin = require('webpack-livereload-plugin'),
  treduxMaterial = require('tredux-material/webpack'),
  rootConfig = require('./config/webpack');

const entries = [
  path.normalize(__dirname + '/src/styles/index.less'),
  // Load all our modules here.
  path.normalize(__dirname + '/src/modules/root/index'),
  path.normalize(__dirname + '/src/index')
];

const config = treduxMaterial({
  entry: entries,
  output: {
    filename: "ui.js"
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        loader: 'babel-loader',
        exclude: /node_modules\/(?!(tredux-material)\/).*/,
        options: {
          presets: ['react', 'env']
        }
      },
      {
        test: /\.less|\.css$/,
        loader: ExtractTextPlugin.extract("style-loader?url=false", "css-loader?url=false&minimize!postcss-loader!less-loader?url=false")
      }
    ]
  },
  plugins: [
    new webpack.DefinePlugin(rootConfig),
    new webpack.optimize.OccurenceOrderPlugin(),
    new ExtractTextPlugin("/../css/ui.css")
  ],
  resolve: {},
  externals: {
    moment: 'moment'
  }
}, __dirname);


if (process.env.NODE_ENV === 'production') {
  config.plugins.push(new webpack.optimize.UglifyJsPlugin({
    compress: {warnings: false},
    comments: false
  }));
  config.plugins.push(new webpack.BannerPlugin('Copyright UNLOQ Systems LTD'));
} else if (process.env.NODE_ENV === 'development') {
  /* Live-reload configuration */
  const liveOpt = {
    port: 36858,
    hostname: 'localhost',
    appendScriptTag: true
  };
  if (liveOpt) {
    config.plugins.push(new LiveReloadPlugin(liveOpt));
  }
}
module.exports = config;