tidy up a bit

This commit is contained in:
Rich Harris
2018-01-21 15:04:22 -05:00
parent dd8deb2d8a
commit 03ce2ea998
13 changed files with 19 additions and 519 deletions

View File

@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import glob from 'glob';
import * as templates from './templates.js';
import { create_templates, render } from './templates.js';
import * as route_manager from './route_manager.js';
function ensure_array(thing) {
@@ -9,7 +9,7 @@ function ensure_array(thing) {
}
export default function generate_asset_cache({ src, dest, dev, client_info, server_info }) {
templates.create_templates(); // TODO refactor this...
create_templates(); // TODO refactor this...
const main_file = `/client/${ensure_array(client_info.assetsByChunkName.main)[0]}`;
@@ -71,7 +71,7 @@ function generate_service_worker({ chunk_files, src }) {
}
function generate_index(main_file) {
return templates.render(200, {
return render(200, {
styles: '',
head: '',
html: '<noscript>Please enable JavaScript!</noscript>',

View File

@@ -1,12 +1,9 @@
import * as path from 'path';
import relative from 'require-relative';
const webpack = relative('webpack', process.cwd());
export let client;
export let server;
export function get_compilers() {
const webpack = relative('webpack', process.cwd());
return {
client: webpack(
require(path.resolve('webpack.client.config.js'))
@@ -16,12 +13,4 @@ export function get_compilers() {
require(path.resolve('webpack.server.config.js'))
)
};
}
// export const client = webpack(
// require(path.resolve('webpack.client.config.js'))
// );
// export const server = webpack(
// require(path.resolve('webpack.server.config.js'))
// );
}

View File

@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as route_manager from '../route_manager.js';
import * as templates from '../templates.js';
import { create_templates } from '../templates.js';
function posixify(file) {
return file.replace(/[/\\]/g, '/');
@@ -90,7 +90,7 @@ export function start_watching({ src }) {
});
watch('templates/**.html', () => {
templates.create_templates();
create_templates();
// TODO reload current page?
});
}