Move all static files to public/ folder and fix paths

This commit is contained in:
Tanner Collin 2016-12-28 00:50:58 -08:00
parent 83161dc7e0
commit 0ba89c8d9c
18 changed files with 18 additions and 18 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
dist public/bundle.js
public/bundle.js.map
node_modules node_modules
npm-debug.log npm-debug.log
*.swp *.swp

View File

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 178 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -6,9 +6,9 @@
<title>Notica - Notifications from Your Terminal</title> <title>Notica - Notifications from Your Terminal</title>
<![if lt IE 10]> <![if lt IE 10]>
<script async src="/assets/js/es5-shim.min.js"></script> <script async src="/js/es5-shim.min.js"></script>
<script async src="/assets/js/es5-sham.min.js"></script> <script async src="/js/es5-sham.min.js"></script>
<script async src="/assets/js/html5shiv.min.js"></script> <script async src="/js/html5shiv.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
// Fake console to test in IE<9 // Fake console to test in IE<9
if( typeof console == 'undefined' ) if( typeof console == 'undefined' )
@ -23,11 +23,11 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" integrity="sha256-t2/7smZfgrST4FS1DT0bs/KotCM74XlcqZN5Vu7xlrw=" crossorigin="anonymous" media="none" onload="if(media!='all')media='all'" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" integrity="sha256-t2/7smZfgrST4FS1DT0bs/KotCM74XlcqZN5Vu7xlrw=" crossorigin="anonymous" media="none" onload="if(media!='all')media='all'" />
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" media="none" onload="if(media!='all')media='all'" /> <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" media="none" onload="if(media!='all')media='all'" />
<link rel="stylesheet" href="/assets/css/style.css" type="text/css" media="all" /> <link rel="stylesheet" href="/css/style.css" type="text/css" media="all" />
</head> </head>
<body> <body>
<div id='root'> <div id='root'>
</div> </div>
<script src="/static/bundle.js"></script> <script src="/bundle.js"></script>
</body> </body>
</html> </html>

View File

@ -9,10 +9,9 @@ const port = 3000;
app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.urlencoded({ extended: false }));
app.use('/static', express.static(path.join(__dirname, 'dist'))); app.use('/', express.static(path.join(__dirname, 'public')));
app.use('/assets', express.static(path.join(__dirname, 'assets')));
app.get('/*', (req, res) => { app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html')); res.sendFile(path.join(__dirname, 'public/index.html'));
}); });
app.post('*', (req, res) => { app.post('*', (req, res) => {

View File

@ -3,7 +3,7 @@ var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config'); var config = require('./webpack.config');
new WebpackDevServer(webpack(config), { new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath, contentBase: './public',
hot: true, hot: true,
historyApiFallback: true, historyApiFallback: true,
noInfo: true noInfo: true

View File

@ -50,13 +50,13 @@ export default class NotifPage extends React.Component {
let options = { let options = {
body: 'Notification from Notica', body: 'Notification from Notica',
icon: 'assets/img/icon.png', icon: 'img/icon.png',
iconUrl: 'assets/img/icon.png', iconUrl: 'img/icon.png',
vibrate: [200, 100, 200] vibrate: [200, 100, 200]
}; };
try { try {
navigator.serviceWorker.register('/assets/js/sw.js').then((reg) => { navigator.serviceWorker.register('/js/sw.js').then((reg) => {
reg.showNotification(title, options); reg.showNotification(title, options);
}); });
} catch (e) { // If we are on a browser without serviceWorker } catch (e) { // If we are on a browser without serviceWorker

View File

@ -32,7 +32,7 @@ export default class Site extends React.Component {
<div className="hero"> <div className="hero">
<div className="title"> <div className="title">
<Link to={'/home/' + id}> <Link to={'/home/' + id}>
<img src="/assets/img/logo.svg" /> <img src="/img/logo.svg" />
<span className="name">Notica</span> <span className="name">Notica</span>
</Link> </Link>
</div> </div>

View File

@ -9,9 +9,9 @@ module.exports = {
'./src/index' './src/index'
], ],
output: { output: {
path: path.join(__dirname, 'dist'), path: path.join(__dirname, 'public'),
filename: 'bundle.js', filename: 'bundle.js',
publicPath: '/static/' publicPath: ''
}, },
plugins: [ plugins: [
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),

View File

@ -7,9 +7,9 @@ module.exports = {
'./src/index' './src/index'
], ],
output: { output: {
path: path.join(__dirname, 'dist'), path: path.join(__dirname, 'public'),
filename: 'bundle.js', filename: 'bundle.js',
publicPath: '/static/' publicPath: ''
}, },
plugins: [ plugins: [
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),