leanweb 1.1.6 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -488,21 +488,6 @@ Importing a JSON file:
488
488
  import someJSON from "./some.json";
489
489
  ```
490
490
 
491
- Importing CSS/SCSS:
492
-
493
- ```javascript
494
- import agate from "/node_modules/highlight.js/scss/agate.scss";
495
-
496
- // customElements.define('demo-root',
497
- // class extends LWElement { // LWElement extends HTMLElement
498
- // constructor() {
499
- // super(ast);
500
- super.applyStyles(agate);
501
- // }
502
- // }
503
- //);
504
- ```
505
-
506
491
  ## Component Communication
507
492
 
508
493
  The following project demonstrates how Leanweb helps web components to talk to
@@ -674,11 +659,6 @@ Called when the componnet `lw-if` is evaluated `false`.
674
659
  If `urlHashChanged()` is defined as a function, it will be called whenever the
675
660
  urlHash changes. This could be useful to update the DOM in component routing.
676
661
 
677
- #### applyStyles(...styles)
678
-
679
- `applyStyles` will apply the styles that is imported from a css or scss into
680
- the web component DOM.
681
-
682
662
  ### LWEventBus
683
663
 
684
664
  `LWElement` comes with a global instance of `LWEventBus` that helps web
package/commands/build.js CHANGED
@@ -81,10 +81,10 @@ const require = createRequire(import.meta.url);
81
81
  const scssFileExists = fs.existsSync(scssFilename);
82
82
  let cssString = '';
83
83
  if (scssFileExists) {
84
- let scssString = `@use "${buildDir}/global-styles.scss";\n`;
84
+ let scssString = `@use "global-styles.scss";\n`;
85
85
  scssString += fs.readFileSync(scssFilename, 'utf8');
86
86
  scssString += '\n[lw-false],[lw-for]{display:none !important;}\n';
87
- cssString = utils.buildCSS(scssString, `${buildDir}/components/${cmp}`);
87
+ cssString = utils.buildCSS(scssString, buildDir, `${buildDir}/components/${cmp}`);
88
88
  }
89
89
  const styleString = cssString || '';
90
90
  const htmlString = fs.readFileSync(htmlFilename, 'utf8');
package/commands/utils.js CHANGED
@@ -28,10 +28,10 @@ export const copySymbolLinkFilter = (src, dest) => {
28
28
 
29
29
  export const exec = command => execSync(command, { encoding: 'utf8', stdio: 'inherit' });
30
30
 
31
- export const buildCSS = (scssString, currentPaths) => {
31
+ export const buildCSS = (scssString, ...currentPaths) => {
32
32
  if (scssString.trim()) {
33
- const includePaths = [currentPaths, path.resolve(process.cwd(), dirs.build), path.resolve(process.cwd(), 'node_modules')];
34
- const cssResult = sass.renderSync({ data: scssString, includePaths });
33
+ const loadPaths = [...currentPaths, path.resolve(process.cwd(), dirs.build), path.resolve(process.cwd(), 'node_modules')];
34
+ const cssResult = sass.compileString(scssString, { loadPaths });
35
35
  return cssResult.css.toString().trim();
36
36
  }
37
37
  return '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leanweb",
3
- "version": "1.1.6",
3
+ "version": "1.1.9",
4
4
  "description": "Builds framework agnostic web components.",
5
5
  "bin": {
6
6
  "leanweb": "leanweb.js",
@@ -20,25 +20,25 @@
20
20
  "author": "Qian Chen",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@babel/core": "^7.17.0",
24
- "@babel/parser": "^7.17.0",
23
+ "@babel/core": "^7.17.8",
24
+ "@babel/parser": "^7.17.8",
25
25
  "@babel/plugin-transform-runtime": "^7.17.0",
26
26
  "@babel/preset-env": "^7.16.11",
27
- "babel-loader": "^8.2.3",
28
- "clean-css": "^5.2.4",
29
- "css-loader": "^6.6.0",
30
- "fs-extra": "^10.0.0",
27
+ "babel-loader": "^8.2.4",
28
+ "clean-css": "^5.3.0",
29
+ "css-loader": "^6.7.1",
30
+ "fs-extra": "^10.0.1",
31
31
  "globby": "^13.1.1",
32
32
  "html-minifier": "^4.0.0",
33
- "isomorphic-git": "^1.11.2",
33
+ "isomorphic-git": "^1.17.0",
34
34
  "json5-loader": "^4.0.1",
35
35
  "node-watch": "^0.7.3",
36
36
  "parse5": "^6.0.1",
37
37
  "raw-loader": "^4.0.2",
38
- "sass": "^1.49.7",
39
- "sass-loader": "^12.4.0",
38
+ "sass": "^1.49.11",
39
+ "sass-loader": "^12.6.0",
40
40
  "semver": "^7.3.5",
41
- "webpack": "^5.68.0",
42
- "webpack-dev-server": "^4.7.4"
41
+ "webpack": "^5.71.0",
42
+ "webpack-dev-server": "^4.8.0"
43
43
  }
44
44
  }