Integración con webpack (Beta)
This commit is contained in:
parent
8369d48584
commit
6988bb9f84
4
app.js
4
app.js
|
@ -25,11 +25,11 @@ function loadLocale (lang, cb)
|
|||
switch (lang)
|
||||
{
|
||||
case 'ca':
|
||||
require ([], function (){
|
||||
require ([], function (){
|
||||
cb (require.context ('locale/ca/js')); });
|
||||
break;
|
||||
case 'es':
|
||||
require ([], function () {
|
||||
require ([], function () {
|
||||
cb (require.context ('locale/es/js')); });
|
||||
break;
|
||||
case 'fr':
|
||||
|
|
|
@ -15,5 +15,8 @@
|
|||
"dependencies": {
|
||||
"mootools": "^1.5.2",
|
||||
"tinymce": "^4.4.3"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --devtool eval --inline --progress --colors"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,12 @@ if ($result = $db->query ('SELECT name, content FROM metatag'))
|
|||
$result->free ();
|
||||
}
|
||||
|
||||
$this->includeJs ('hedera-web.js');
|
||||
if (DEBUG_MODE)
|
||||
{
|
||||
$this->includeJs ('http://localhost:8080/webpack-dev-server.js');
|
||||
$this->includeJs ('http://localhost:8080/build/hedera-web.js');
|
||||
}
|
||||
else
|
||||
$this->includeJs ('build/hedera-web.js');
|
||||
|
||||
?>
|
||||
|
|
|
@ -14,7 +14,7 @@ class HtmlService extends Service
|
|||
$db = $this->db;
|
||||
|
||||
if (!$this->isHttps ()
|
||||
&& $db->getValue ('SELECT https FROM config'))
|
||||
&& $db->getValue ('SELECT https FROM config') && !DEBUG_MODE)
|
||||
{
|
||||
header ("Location: https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}");
|
||||
exit (0);
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
|
||||
var fs = require ('fs');
|
||||
var webpack = require ('webpack');
|
||||
var path = require ('path');
|
||||
|
||||
var devMode = true;
|
||||
|
||||
module.exports =
|
||||
{
|
||||
entry: './app.js',
|
||||
entry: ['./app.js'],
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename: 'hedera-web.js'
|
||||
path: path.join (__dirname, 'build'),
|
||||
filename: 'hedera-web.js',
|
||||
chunkFilename: 'chunk.[id].js',
|
||||
publicPath: devMode ? 'http://localhost:8080/build/' : 'build/',
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: 'style!css' },
|
||||
{ test: /\.json$/, loader: 'json' },
|
||||
{ test: /\.png$/, loader: 'file' },
|
||||
{ test: /\.xml$/, loader: 'raw' }
|
||||
]
|
||||
},
|
||||
|
@ -30,6 +33,8 @@ module.exports =
|
|||
*/ ]
|
||||
};
|
||||
/*
|
||||
var fs = require ('fs');
|
||||
|
||||
var configs = [];
|
||||
var langs = fs.readdirSync ('./locale');
|
||||
|
||||
|
|
Loading…
Reference in New Issue