Commit 1ef16083 by Ari Rizzitano

slight restructure

parent 02b508dc
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
output: {
filename: 'static/index.js',
library: 'paragon',
libraryTarget: 'umd',
},
plugins: [
new ExtractTextPlugin('static/paragon.min.css'),
],
module: {
rules: [
{
test: /\.scss|\.css$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: 'paragon__[local]',
sourceMap: true,
minimize: true,
},
},
{
loader: 'sass-loader',
options: {
data: '@import "paragon-reset";',
includePaths: [
path.join(__dirname, '../src/utils'),
path.join(__dirname, '../node_modules'),
],
sourceMap: true,
},
},
],
}),
},
{
test: /\.(woff2?|ttf|svg|eot)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
options: {
outputPath: 'static/',
},
},
],
},
};
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
output: {
filename: 'themeable/paragon.min.js',
library: 'paragon',
libraryTarget: 'umd',
},
plugins: [
new ExtractTextPlugin('themeable/paragon.min.css'),
],
module: {
rules: [
{
test: /\.scss|\.css$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[local]',
sourceMap: true,
minimize: true,
},
},
{
loader: 'sass-loader',
options: {
data: '@import "paragon-reset";',
includePaths: [
path.join(__dirname, '../src/utils'),
path.join(__dirname, '../node_modules'),
],
},
},
],
}),
},
{
test: /\.(woff2?|ttf|svg|eot)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
options: {
outputPath: 'themeable/',
},
},
],
},
};
......@@ -16531,23 +16531,6 @@
"strip-ansi": "3.0.1"
}
},
"webpack-merge": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.1.1.tgz",
"integrity": "sha512-geQsZ86YkXOVOjvPC5yv3JSNnL6/X3Kzh935AQ/gJNEYXEfJDQFu/sdFuktS9OW2JcH/SJec8TGfRdrpHshH7A==",
"dev": true,
"requires": {
"lodash": "4.17.4"
},
"dependencies": {
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
"dev": true
}
}
},
"webpack-sources": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.2.tgz",
......
......@@ -2,14 +2,14 @@
"name": "@edx/paragon",
"version": "0.0.0-development",
"description": "Accessible, responsive UI component library based on Bootstrap.",
"main": "themeable/paragon.min.js",
"main": "themeable/index.js",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/edx/paragon.git"
},
"scripts": {
"build": "NODE_ENV=production webpack --config config/webpack.config.js",
"build": "NODE_ENV=production webpack --config webpack.config.js",
"build-storybook": "build-storybook",
"commitmsg": "commitlint -e $GIT_PARAMS",
"coveralls": "cat ./coverage/lcov.info | coveralls",
......@@ -79,8 +79,7 @@
"uglifyjs-webpack-plugin": "^1.1.4",
"webpack": "^3.0.0",
"webpack-build-notifier": "^0.1.16",
"webpack-dev-server": "^2.4.4",
"webpack-merge": "^4.1.0"
"webpack-dev-server": "^2.4.4"
},
"jest": {
"setupFiles": [
......
const path = require('path');
const merge = require('webpack-merge');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const staticConfig = require('./webpack.static.config');
const themeableConfig = require('./webpack.themeable.config');
// we build the library for two different build targets:
// static (with scoped styles) and themeable (with stock,
// overrideable classnames)
const targetProperties = [{
baseDirectory: 'static',
localIdentName: 'paragon__[local]',
},
{
baseDirectory: 'themeable',
localIdentName: '[local]',
}];
const commonConfig = {
module.exports = targetProperties.map(config => ({
devtool: 'source-map',
entry: {
paragon: path.resolve('./src/index.js'),
},
output: {
filename: `${config.baseDirectory}/index.js`,
library: 'paragon',
libraryTarget: 'umd',
},
resolve: {
extensions: ['.js', '.jsx'],
},
......@@ -17,6 +31,7 @@ const commonConfig = {
new UglifyJsPlugin({
sourceMap: true,
}),
new ExtractTextPlugin(`${config.baseDirectory}/paragon.min.css`),
],
module: {
rules: [
......@@ -33,6 +48,40 @@ const commonConfig = {
{ loader: 'source-map-loader' },
],
},
{
test: /\.scss|\.css$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: config.localIdentName,
sourceMap: true,
minimize: true,
},
},
{
loader: 'sass-loader',
options: {
data: '@import "paragon-reset";',
includePaths: [
path.join(__dirname, './src/utils'),
path.join(__dirname, './node_modules'),
],
sourceMap: true,
},
},
],
}),
},
{
test: /\.(woff2?|ttf|svg|eot)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
options: {
outputPath: `${config.baseDirectory}/`,
},
},
],
},
externals: [{
......@@ -59,9 +108,4 @@ const commonConfig = {
amd: 'react-transition-group',
},
}],
};
module.exports = [
merge(commonConfig, staticConfig),
merge(commonConfig, themeableConfig),
];
}));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment