Skip to content

Instantly share code, notes, and snippets.

@shingorow
Last active October 26, 2016 00:58
Show Gist options
  • Save shingorow/edf2fdd643c465c46af0705a1cfd5333 to your computer and use it in GitHub Desktop.
Save shingorow/edf2fdd643c465c46af0705a1cfd5333 to your computer and use it in GitHub Desktop.
riot.js, jquery, sass を使うための設定ファイルとパッケージ設定
{
"name": "foobar",
"version": "1.0.0",
"description": "hage",
"main": "index.js",
"devDependencies": {
"babel": "^6.5.2",
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015-riot": "^1.1.0",
"css-loader": "^0.25.0",
"extract-text-webpack-plugin": "^1.0.1",
"node-sass": "^3.10.1",
"riotjs-loader": "^3.0.0",
"sass-loader": "^4.0.2",
"style-loader": "^0.13.1",
"webpack": "^1.13.2"
},
"keywords": [],
"author": "Hoge",
"license": "MIT",
"dependencies": {
"riot": "^2.4.1",
"superagent": "^2.3.0"
}
}
const webpack = require("webpack");
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = [{
entry: './src/scripts/index.js',
output: {
path: __dirname + '/app/scripts',
filename: 'bundle.js',
publicPath: '/app/',
},
module: {
preLoaders: [
{
test: /\.tag$/,
exclude: /node_modules/,
loader: 'riotjs-loader',
query: {
type: 'babel'
}
}
],
loaders: [
{ test: /\.js$|\.tag$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015-riot'] } },
]
},
resolve: {
extensions: ['', '.js', '.tag']
},
plugins: [
new ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery',
"Tether": 'tether',
"window.Tether": "tether"
}),
new webpack.optimize.UglifyJsPlugin(),
new webpack.ProvidePlugin({
riot: 'riot'
})
]
}, {
entry: { style: './src/stylesheet/index.js' },
output: { path: path.join(__dirname, 'app/stylesheets/'), filename: 'bundle.css' },
module: { loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader?minimize") },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader?minimize") }
] },
plugins: [
new ExtractTextPlugin("bundle.css")
]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment