Skip to content

Commit 4382700

Browse files
committed
Make a separate bundle for the styling
1 parent bc7cbfe commit 4382700

File tree

9 files changed

+24
-80
lines changed

9 files changed

+24
-80
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ coverage
2424
.history/
2525
.vscode/
2626

27-
ui-tests/playwright-report
27+
ui-tests/playwright-report

.gitignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ config.rst
3030
package-lock.json
3131

3232
share/jupyter/voila/templates/base/static/*voila.js
33-
share/jupyter/voila/templates/base/static/*.[woff|woff2|eot|svg]
34-
35-
share/jupyter/voila/templates/classic/static/labvariables.css
36-
share/jupyter/voila/templates/classic/static/materialcolors.css
37-
38-
share/jupyter/voila/templates/reveal/static/labvariables.css
39-
share/jupyter/voila/templates/reveal/static/materialcolors.css
33+
share/jupyter/voila/templates/base/static/*voila-style.js
34+
share/jupyter/voila/templates/base/static/*.woff
35+
share/jupyter/voila/templates/base/static/*.woff2
36+
share/jupyter/voila/templates/base/static/*.eot
37+
share/jupyter/voila/templates/base/static/*.svg
38+
share/jupyter/voila/templates/base/static/*.ttf
4039

4140
lib
4241

hatch_build.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/voila/src/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
// Inspired by: https://github.com/jupyterlab/jupyterlab/blob/master/dev_mode/index.js
1414

15-
import './style.css';
16-
1715
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
1816

1917
import { VoilaApp } from './app';

packages/voila/style/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import url('~@fortawesome/fontawesome-free/css/all.min.css');
2+
@import url('~@fortawesome/fontawesome-free/css/v4-shims.min.css');
3+
@import url('~@lumino/widgets/style/index.css');
4+
@import url('~@jupyterlab/apputils/style/index.css');

packages/voila/style/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './index.css';

packages/voila/webpack.config.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ fs.ensureDirSync(buildDir);
2727

2828
// Copy files to the build directory
2929
const libDir = path.resolve(__dirname, 'lib');
30-
const style = path.resolve(__dirname, 'style.css');
3130
fs.copySync(libDir, buildDir);
32-
fs.copySync(style, path.resolve(buildDir, 'style.css'));
3331

3432
const extras = Build.ensureAssets({
3533
packageNames: names,
@@ -39,6 +37,10 @@ const extras = Build.ensureAssets({
3937
// Make a bootstrap entrypoint
4038
const entryPoint = path.join(buildDir, 'bootstrap.js');
4139

40+
// Also build the style bundle
41+
const styleDir = path.resolve(__dirname, 'style');
42+
const styleEntryPoint = path.join(styleDir, 'index.js');
43+
4244
if (process.env.NODE_ENV === 'production') {
4345
baseConfig.mode = 'production';
4446
}
@@ -79,5 +81,12 @@ module.exports = [
7981
}
8082
})
8183
]
84+
}),
85+
merge(baseConfig, {
86+
entry: './' + path.relative(__dirname, styleEntryPoint),
87+
output: {
88+
path: distRoot,
89+
filename: 'voila-style.js'
90+
}
8291
})
8392
].concat(extras);

pyproject.toml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ artifacts = [
8383
"share/jupyter/voila/templates"
8484
]
8585

86-
[tool.hatch.build.hooks.custom]
87-
path = "hatch_build.py"
88-
8986
[tool.hatch.build.targets.wheel.shared-data]
9087
"etc/jupyter" = "etc/jupyter"
9188
"voila/labextension" = "share/jupyter/labextensions/@voila-dashboards/jupyterlab-preview"
@@ -103,20 +100,6 @@ dependencies = [
103100
"hatch-jupyter-builder>=0.5.3",
104101
]
105102
build-function = "hatch_jupyter_builder.npm_builder"
106-
ensured-targets = [
107-
"voila/labextension/static/style.js",
108-
"share/jupyter/voila/templates/classic/static/materialcolors.css",
109-
"share/jupyter/voila/templates/classic/static/labvariables.css",
110-
"share/jupyter/voila/templates/reveal/static/materialcolors.css",
111-
"share/jupyter/voila/templates/reveal/static/labvariables.css",
112-
]
113-
skip-if-exists = [
114-
"voila/labextension/static/style.js",
115-
"share/jupyter/voila/templates/classic/static/materialcolors.css",
116-
"share/jupyter/voila/templates/classic/static/labvariables.css",
117-
"share/jupyter/voila/templates/reveal/static/materialcolors.css",
118-
"share/jupyter/voila/templates/reveal/static/labvariables.css",
119-
]
120103

121104
[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
122105
build_cmd = "build"

share/jupyter/voila/templates/base/voila_setup.macro.html.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{%- macro voila_setup_labextensions(base_url, labextensions) -%}
22
<script src="{{ page_config['fullStaticUrl'] | e }}/voila.js"></script>
3+
<script src="{{ page_config['fullStaticUrl'] | e }}/voila-style.js"></script>
34
{%- endmacro %}
45

56
{# For backward compatibility #}

0 commit comments

Comments
 (0)