1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-10 21:30:06 +02:00

static subfolders for easier static hosting

This commit is contained in:
Sérgio Ramos 2016-10-31 14:24:31 +00:00
parent 286dafca16
commit 7661a34b27
10 changed files with 24 additions and 14 deletions

View File

@ -1,6 +1,7 @@
*
!.gitignore
!theme.css
!.gitkeep
!index.html
!reboot.css
js/*
!js/.gitkeep

4
ui/static/css/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!.gitignore
!theme.css
!reboot.css

View File

@ -2,12 +2,12 @@
<html lang='en-US'>
<head>
<title>Joyent UI Framework</title>
<link href="/static/theme.css" rel="stylesheet" type="text/css">
<link href="/static/reboot.css" rel="stylesheet" type="text/css">
<link href="/static/docs.css" rel="stylesheet" type="text/css">
<link href="css/theme.css" rel="stylesheet" type="text/css">
<link href="css/reboot.css" rel="stylesheet" type="text/css">
<link href="css/docs.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id='root'></div>
<script src='/static/docs.js'></script>
<script src='js/docs.js'></script>
</body>
</html>

0
ui/static/js/.gitkeep Normal file
View File

View File

@ -6,7 +6,7 @@ const cssFunctions = require('../src/shared/functions');
const plugins = {
'no-errors-plugin': new webpack.NoErrorsPlugin(),
'extract-text-plugin': new ExtractTextPlugin({
filename: '[name].css',
filename: 'css/[name].css',
allChunks: true
}),
'loader-options-plugin': new webpack.LoaderOptionsPlugin({
@ -33,8 +33,8 @@ exports.config = {
context: path.join(__dirname, '../'),
output: {
path: path.join(__dirname, '../static'),
publicPath: '/static/',
filename: '[name].js'
publicPath: '/',
filename: 'js/[name].js'
},
plugins: [
plugins['no-errors-plugin'],

View File

@ -1,14 +1,17 @@
const pkg = require('../package.json');
const base = require('./base.js');
const webpack = require('webpack');
const path = require('path');
const devServer = {
contentBase: [
path.join(__dirname, '../static/')
],
hot: true,
compress: true,
lazy: false,
publicPath: '/static/',
historyApiFallback: {
index: './static/index.html'
index: './index.html'
}
};

View File

@ -82,11 +82,12 @@ module.exports = ({
return fn(err);
}
let style = mfs.readdirSync('/static').filter((file) => {
// TODO read extract css defs
let style = mfs.readdirSync('/static/css').filter((file) => {
return /\.css$/.test(file);
}).map((file) => {
try {
return mfs.readFileSync(`/static/${file}`, 'utf-8');
return mfs.readFileSync(`/static/css/${file}`, 'utf-8');
} catch (err) {
return '';
}

View File

@ -2,10 +2,11 @@ const WebpackShellPlugin = require('webpack-shell-plugin');
const base = require('./base.js');
const webpack = require('webpack');
const entries = require('./entrypoints');
const path = require('path');
module.exports = Object.assign(base.config, {
entry: entries.reduce((all, entry) => {
all[entry.name] = [entry.path];
all[entry.name] = [`./${path.relative(base.config.context, entry.path)}`];
return all;
}, {}),
plugins: base.config.plugins.concat([