Skip to content

Commit b28c38a

Browse files
authored
JI-5452 remove compass and use webpack to build css (#228)
Co-authored-by: William Almnes <[email protected]>
1 parent e217fd6 commit b28c38a

10 files changed

+2105
-73
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.sass-cache
33
/styles/nbproject/private/
44
vendor
5-
.idea
5+
.idea
6+
node_modules/

package-lock.json

+2,010
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "h5p-editor-php-library",
3+
"version": "1.0.0",
4+
"description": "A general library that is supposed to be used in most PHP implementations of H5P.",
5+
"scripts": {
6+
"build": "webpack && rm styles/css/index.js",
7+
"watch": "webpack --watch"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "SEE LICENSE IN README.md",
12+
"devDependencies": {
13+
"css-loader": "^6.10.0",
14+
"mini-css-extract-plugin": "^2.8.1",
15+
"sass": "^1.72.0",
16+
"sass-loader": "^14.1.1",
17+
"style-loader": "^3.3.4",
18+
"webpack": "^5.91.0",
19+
"webpack-cli": "^5.1.4"
20+
}
21+
}

styles/config.rb

-24
This file was deleted.

styles/css/application.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

styles/scss/_form-groups.scss

+10-10
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@
179179
}
180180

181181
.order-up, .order-down {
182-
width: $form-item-height-normal / 2;
183-
height: $form-item-height-normal / 2;
184-
line-height: $form-item-height-normal / 2;
182+
width: calc($form-item-height-normal / 2);
183+
height: calc($form-item-height-normal / 2);
184+
line-height: calc($form-item-height-normal / 2);
185185

186186
&:hover {
187187
background: $form-item-importance-medium-background-hover;
@@ -227,9 +227,9 @@
227227
}
228228

229229
.order-up, .order-down {
230-
width: $form-item-height-large / 2;
231-
height: $form-item-height-large / 2;
232-
line-height: $form-item-height-large / 2;
230+
width: calc($form-item-height-large / 2);
231+
height: calc($form-item-height-large / 2);
232+
line-height: calc($form-item-height-large / 2);
233233

234234
&:hover {
235235
background: $form-item-importance-high-background-hover;
@@ -271,11 +271,11 @@
271271
}
272272

273273
.order-up, .order-down {
274-
width: $form-item-height-normal / 2;
275-
height: $form-item-height-normal / 2;
274+
width: calc($form-item-height-normal / 2);
275+
height: calc($form-item-height-normal / 2);
276276
background: $form-item-importance-low-border-color;
277277
font-size: $font-size-normal;
278-
line-height: $form-item-height-normal / 2;
278+
line-height: calc($form-item-height-normal / 2);
279279

280280
&:hover {
281281
background: $form-item-importance-low-background-hover;
@@ -302,7 +302,7 @@
302302
&:before {
303303
content: "\e566";
304304
font-family: $icon-font-family;
305-
margin-right: $min-padding/2;
305+
margin-right: calc($min-padding / 2);
306306
}
307307

308308
&:focus:before {

styles/scss/_fullscreen-bar.scss

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@font-face {
22
font-family: 'h5p-fullscreen-bar';
3-
src: url('fonts/h5p-fullscreen-bar.eot?p850ul');
4-
src: url('fonts/h5p-fullscreen-bar.eot?p850ul#iefix') format('embedded-opentype'),
5-
url('fonts/h5p-fullscreen-bar.ttf?p850ul') format('truetype'),
6-
url('fonts/h5p-fullscreen-bar.woff?p850ul') format('woff'),
7-
url('fonts/h5p-fullscreen-bar.svg?p850ul#h5p') format('svg');
3+
src: url('../css/fonts/h5p-fullscreen-bar.eot?p850ul');
4+
src: url('../css/fonts/h5p-fullscreen-bar.eot?p850ul#iefix') format('embedded-opentype'),
5+
url('../css/fonts/h5p-fullscreen-bar.ttf?p850ul') format('truetype'),
6+
url('../css/fonts/h5p-fullscreen-bar.woff?p850ul') format('woff'),
7+
url('../css/fonts/h5p-fullscreen-bar.svg?p850ul#h5p') format('svg');
88
font-weight: normal;
99
font-style: normal;
1010
}

styles/scss/_tutorial-and-example-links.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $h5p-tutorial-icon-diameter: 2rem;
2222
margin-bottom: 0.5em;
2323
margin-left: 0.25em;
2424
height: $h5p-tutorial-icon-diameter;
25-
border-radius: $h5p-tutorial-icon-diameter / 2;
25+
border-radius: calc($h5p-tutorial-icon-diameter / 2);
2626

2727
&:focus {
2828
@include h5p-tutorial-focus-shadow;

styles/scss/application.scss

+24-31
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
@import "compass/css3/border-radius";
2-
@import "compass/css3/box-shadow";
3-
@import "compass/css3/opacity";
4-
@import "compass/css3/text-shadow";
5-
@import "compass/css3/transition";
6-
@import "compass/css3/transform";
7-
81
@import "variables";
92
@import "mixins";
103
@import "utils";
@@ -85,7 +78,7 @@ a {
8578
textarea,
8679
.h5peditor-text,
8780
.ckeditor {
88-
@include box-shadow($form-input-box-shadow);
81+
box-shadow: $form-input-box-shadow;
8982
box-sizing: border-box;
9083
margin: 0;
9184
padding: $min-padding;
@@ -156,7 +149,7 @@ a {
156149
border: 1px solid $form-border-color;
157150
background: $form-input-color inline-image('down.png') no-repeat;
158151
background-position: calc(100% - 10px);
159-
@include box-shadow($form-input-box-shadow);
152+
box-shadow: $form-input-box-shadow;
160153
-moz-appearance: none;
161154
-webkit-appearance: none;
162155

@@ -266,13 +259,13 @@ a {
266259
border: 1px solid #cdcdcd;
267260
box-sizing: border-box;
268261
-moz-box-sizing: border-box;
269-
@include box-shadow(0 0 8px #666);
270-
@include transition(visibility 0s 0.2s, opacity 0.2s);
262+
box-shadow: 0 0 8px #666;
263+
transition: visibility 0s 0.2s, opacity 0.2s;
271264

272265
&.h5p-open {
273266
visibility: visible;
274267
opacity: 1;
275-
@include transition(visibility 0s 0s, opacity 0.2s);
268+
transition: visibility 0s 0s, opacity 0.2s;
276269
}
277270

278271
.h5p-add-dialog-table {
@@ -505,7 +498,7 @@ a {
505498
display: block;
506499
float: left;
507500
position: relative;
508-
@include box-shadow(0 0 10px 0 #666666);
501+
box-shadow: 0 0 10px 0 #666666;
509502
border: 1px solid #fff;
510503
box-sizing: border-box;
511504
-moz-box-sizing: border-box;
@@ -522,18 +515,18 @@ a {
522515
overflow: hidden;
523516
text-indent: -0.4em;
524517
padding: 0.065em;
525-
@include opacity(0.6);
518+
opacity: 0.6;
526519
}
527520
.h5p-remove:hover,
528521
.h5p-remove:focus {
529-
@include opacity(1);
522+
opacity: 1;
530523
}
531524
.h5p-remove:after {
532525
font-family: $icon-font-family;
533526
font-size: 2em;
534527
color: #fff;
535528
content: "\e890";
536-
@include opacity(0.6);
529+
opacity: 0.6;
537530
}
538531
}
539532
.h5p-type {
@@ -564,7 +557,7 @@ a {
564557
.thumbnail {
565558
display: inline-block;
566559
margin: 10px 10px 10px 0;
567-
@include box-shadow(0 0 10px 0 #666666);
560+
box-shadow: 0 0 10px 0 #666666;
568561
border: 1px solid #fff;
569562
cursor: pointer;
570563
max-width: 100%;
@@ -573,7 +566,7 @@ a {
573566
background: $form-input-color inline-image('transparent-background.png') repeat;
574567
}
575568
.thumbnail:focus {
576-
@include box-shadow(0 0 10px 0 #222);
569+
box-shadow: 0 0 10px 0 #222;
577570
}
578571
.add {
579572
display: inline-block;
@@ -613,23 +606,23 @@ a {
613606
cursor: pointer;
614607
}
615608
.remove:focus:before {
616-
@include opacity(1);
609+
opacity: 1;
617610
}
618611
.remove:before {
619612
font-family: $icon-font-family;
620613
font-size: 1.4em;
621614
color: #fff;
622615
content: "\e890";
623-
@include opacity(0.6);
624-
@include text-shadow(rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px);
616+
opacity: 0.6;
617+
text-shadow: rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px;
625618
}
626619
.remove:hover {
627620
text-decoration: none;
628621
}
629622
.remove:hover:before {
630623
color: #fff;
631-
@include opacity(1);
632-
@include text-shadow(rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px);
624+
opacity: 1;
625+
text-shadow: rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px, rgba(black, 0.4) 0 0 4px;
633626
}
634627
img {
635628
max-width: 100%;
@@ -707,7 +700,7 @@ a {
707700
.moving {
708701
position: absolute;
709702
z-index: 1;
710-
@include opacity(0.8);
703+
opacity: 0.8;
711704
-webkit-transform: translateZ(0);
712705

713706
.h5peditor-label {
@@ -728,7 +721,7 @@ a {
728721
}
729722

730723
.h5p-copyright-button {
731-
@include border-radius(0.25em);
724+
border-radius: 0.25em;
732725
height: 30px;
733726
background: linear-gradient(to bottom, #fff 0, #f2f2f2 100%);
734727
border: 1px solid $form-border-color;
@@ -777,15 +770,15 @@ a {
777770
height: 0;
778771
overflow: hidden;
779772
background: #fff;
780-
@include box-shadow(0 0 8px #666);
781-
@include transition(visibility 0s 0.2s, height 0s 0.2s, opacity 0.2s, margin-top 0.2s);
773+
box-shadow: 0 0 8px #666;
774+
transition: visibility 0s 0.2s, height 0s 0.2s, opacity 0.2s, margin-top 0.2s;
782775

783776
&.h5p-open {
784777
margin-top: 3.5em;
785778
visibility: visible;
786779
opacity: 1;
787780
height: auto;
788-
@include transition(visibility 0s 0s, height 0s 0s, opacity 0.2s, margin-top 0.2s);
781+
transition: visibility 0s 0s, height 0s 0s, opacity 0.2s, margin-top 0.2s;
789782
}
790783

791784
& > .field {
@@ -816,11 +809,11 @@ a {
816809
font-family: $icon-font-family;
817810
content: "\e894";
818811
line-height: 1em;
819-
@include transition(scale 0.2s);
812+
transition: scale 0.2s;
820813
}
821814

822815
&:hover:before {
823-
@include scale(1.1, 1.1);
816+
scale: 1.1, 1.1;
824817
}
825818
}
826819
}
@@ -839,7 +832,7 @@ a {
839832
/* Placed this outside of .h5peditor context above. Don't want it to be more
840833
specific than neccessary (because of overriding) */
841834
.h5peditor-button-textual {
842-
@include border-radius(0.25em);
835+
border-radius: 0.25em;
843836
@include button-background(
844837
$form-item-importance-medium-background,
845838
$form-item-importance-medium-background-highlight);

webpack.config.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const path = require('path');
2+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3+
4+
5+
module.exports = {
6+
output: {
7+
path: path.resolve(__dirname, "styles/css"),
8+
},
9+
entry: {
10+
index: [path.join(path.resolve(__dirname, 'styles'), "scss", "application.scss")]
11+
} ,
12+
mode: "production",
13+
module: {
14+
rules: [
15+
{
16+
test: /\.s[ac]ss$/i,
17+
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
18+
},
19+
{
20+
test: /\.(woff(2)?|ttf|eot|svg)$/,
21+
type: 'asset/resource',
22+
generator: {
23+
filename: './fonts/[name][ext]',
24+
},
25+
},
26+
]
27+
},
28+
plugins: [new MiniCssExtractPlugin({
29+
filename: "application.css"
30+
})]
31+
};

0 commit comments

Comments
 (0)