Skip to content

Commit 6e8db51

Browse files
committed
Add css file
1 parent 4e5df07 commit 6e8db51

File tree

5 files changed

+194
-28
lines changed

5 files changed

+194
-28
lines changed

css/ipycanvas.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.ipycanvas {
2+
height: '500px';
3+
overflow: 'hidden';
4+
flex: '1 1 auto';
5+
}

package-lock.json

Lines changed: 180 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
],
1111
"files": [
1212
"lib/**/*.js",
13-
"dist/*.js"
13+
"dist/*.js",
14+
"css/*.css"
1415
],
1516
"homepage": "https://github.com/martinRenou/ipycanvas",
1617
"bugs": {
@@ -44,7 +45,9 @@
4445
},
4546
"dependencies": {
4647
"@jupyter-widgets/base": "^2.0.1",
47-
"lodash": ">=4.17.13"
48+
"css-loader": "^3.2.0",
49+
"lodash": ">=4.17.13",
50+
"style-loader": "^1.0.0"
4851
},
4952
"devDependencies": {
5053
"@phosphor/application": "^1.6.0",

src/widget.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
MODULE_NAME, MODULE_VERSION
1010
} from './version';
1111

12+
import '../css/ipycanvas.css'
13+
1214

1315
export
1416
class CanvasModel extends DOMWidgetModel {
@@ -62,9 +64,6 @@ class CanvasView extends DOMWidgetView {
6264
this.canvas.height = '100%';
6365

6466
this.el.appendChild(this.canvas);
65-
this.el.height = '500px';
66-
this.el.overflow = 'hidden';
67-
this.el.flex = '1 1 auto';
6867

6968
this.ctx = this.canvas.getContext('2d');
7069

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const version = require('./package.json').version;
44
// Custom webpack rules
55
const rules = [
66
{ test: /\.ts$/, loader: 'ts-loader' },
7-
{ test: /\.js$/, loader: 'source-map-loader' }
7+
{ test: /\.js$/, loader: 'source-map-loader' },
8+
{ test: /\.css$/, use: ['style-loader', 'css-loader']},
89
];
910

1011
// Packages that shouldn't be bundled but loaded at runtime

0 commit comments

Comments
 (0)