Browse Source

use ExtractTextPlugin

experimental
Paweł Jedwabny 4 years ago
parent
commit
6362c7fb2f
3 changed files with 13 additions and 3 deletions
  1. +1
    -1
      index.php
  2. +1
    -0
      package.json
  3. +11
    -2
      webpack.config.js

+ 1
- 1
index.php View File

@@ -61,7 +61,7 @@ ob_start();
<meta name="robots" content="NOINDEX, NOARCHIVE">
<script type='text/javascript' src='dist/index.js'></script>
<?php
$csses = array('vendor/bower-asset/gentelella/build/css/custom.css','vendor/bower-asset/gentelella/vendors/select2/dist/css/select2.css','vendor/bower-asset/gentelella/vendors/font-awesome/css/font-awesome.min.css');
$csses = array('dist/styles.css', 'vendor/bower-asset/gentelella/build/css/custom.css','vendor/bower-asset/gentelella/vendors/select2/dist/css/select2.css','vendor/bower-asset/gentelella/vendors/font-awesome/css/font-awesome.min.css');
foreach($csses as $css)
print('<link href="'.$css.'" rel="stylesheet" type="text/css">');
?>


+ 1
- 0
package.json View File

@@ -28,6 +28,7 @@
"babel-preset-env": "^1.6.0",
"css-loader": "^0.28.7",
"expose-loader": "^0.7.3",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"less": "^2.7.2",
"less-loader": "^4.0.5",


+ 11
- 2
webpack.config.js View File

@@ -1,3 +1,5 @@
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
context: __dirname + "/src",
entry: "./index",
@@ -10,7 +12,11 @@ module.exports = {
loaders: [
{test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' },
{test: /\.less$/, loader: 'style-loader!css-loader!less-loader'},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})},
{test: /\.woff(2)?(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/octet-stream" },
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file-loader" },
@@ -28,5 +34,8 @@ module.exports = {
}
}
]
}
},
plugins: [
new ExtractTextPlugin("styles.css")
]
};

Loading…
Cancel
Save