Rename static directory to generated

This commit is contained in:
projectmoon 2021-01-09 13:03:07 +00:00
parent 55dff277ef
commit a34e8d24c6
5 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ todo.org
node_modules
static/scripts/dist
static/templates/*
generated/

View File

@ -1,5 +1,5 @@
[default]
template_dir = "static/templates/"
template_dir = "generated/templates/"
[development]
address = "localhost"

View File

@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"webpack-dev": "cd static/scripts && webpack serve --watch --inline --port 8081 --host 0.0.0.0 --output-path=./build",
"webpack-dev": "webpack serve --watch --inline --port 8081 --host 0.0.0.0 --output-path=./build",
"build:protobuf": "mkdir -p src/frontend/_proto && protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts -I ./proto --js_out=import_style=commonjs,binary:./src/frontend/_proto --ts_out=service=grpc-web:./src/frontend/_proto ./proto/*.proto",
"build:webpack": "webpack"
},

View File

@ -43,7 +43,7 @@ async fn make_rocket(database: sqlx::SqlitePool) -> Result<(), Box<dyn std::erro
.mount("/api", api_routes)
.mount(
"/scripts",
StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/static/scripts")),
StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/scripts")),
)
.mount(
"/protos",

View File

@ -10,7 +10,7 @@ function packPage(page, chunks) {
if (!chunks) chunks = [];
return new HtmlWebpackPlugin({
template: `${root}/src/frontend/templates/${page}`,
filename: `${root}/static/templates/${page}`,
filename: `${root}/generated/templates/${page}`,
publicPath: '/scripts/dist',
scriptLoading: 'defer',
chunks: chunks,
@ -31,7 +31,7 @@ module.exports = {
},
mode: "development",
output: {
path: `${root}/static/scripts/dist`,
path: `${root}/generated/scripts/dist`,
filename: '[name].bundle.js'
},
devtool: 'inline-source-map',