os-js / OS.js

OS.js - JavaScript Web Desktop Platform
https://www.os-js.org/
Other
6.9k stars 822 forks source link

Overriding core css issue #411

Closed VRspace4 closed 8 years ago

VRspace4 commented 8 years ago

Expected behaviour

When the following is added into 900-custom.json to override core css's with core_custom.css:

//900-custom.json
{
  "stylesheets": [
    "src/client/stylesheets/core.css",
    "src/client/stylesheets/gui.css",
    "src/client/dprm/themes/core_custom.css"
  ]
}
//core_custom.css
body {
  background-color : #1874bb;
}
#LoadingScreen application-splash > gui-progress-bar > div {
  background : rgb(18, 89, 141);
}

It's expected the grunt core command to execute without any errors AND the splash screen and progress bar reflects the custom colors defined in the core_custom.css.

Actual behaviour

With the addition specified above to 900-custom.json, grunt core command executes fine, but the custom css doesn't take effect.

However, if 900-custom.json is changed to the following (removed src/ from core_custom.css line):

//900-custom.json
{
  "stylesheets": [
    "src/client/stylesheets/core.css",
    "src/client/stylesheets/gui.css",
    "client/dprm/themes/core_custom.css"
  ]
}

the splash screen and progress bar does take effect but grunt core command would fail with the following output:

CSS <<< \src\templates\dist\header.css <<< \src\client\stylesheets\core.css <<< \src\client\stylesheets\gui.css <<< \client\dprm\themes\core_custom.css { [Error: ENOENT: no such file or directory, open 'C:\dev\OS.js\client\dprm\themes\core_custom.css'] errno: -4058, code: 'ENOENT', syscall: 'open', path: 'C:\dev\OS.js\client\dprm\themes\core_custom.css' } 'Error: ENOENT: no such file or directory, open \'C:\dev\OS.js\client\dprm\themes\core_custom.css\'\n at Error (native)\n at Object.fs.openSync (fs.js:584:18)\n at Object.fs.readFileSync (fs.j s:431:33)\n at readFile (C:\dev\OS.js\src\build.js:162:16)\n at _cleanup (C:\dev\OS.js\src\build.js:1220:17)\n at C:\dev\OS.js\src\build.js:1242:21\n at Array.forEach (native)\n at _concat (C:\dev\OS.js\src\build.js:1239:12)\n at buildCSS (C:\d ev\OS.js\src\build.js:1262:23)\n at Object.buildCore (C:\dev\OS.js\src\build.js:1272:37)\n at Object. (C:\dev\OS.js\Gruntfile.js:239:14)\n at Object.thisTask.fn (C:\dev\OS.js\node_modules\grunt\lib\grunt\task.js:73:16)\n at Object.<ano nymous> (C:\dev\OS.js\node_modules\grunt\lib\util\task.js:294:30)\n at Task.runTaskFn (C:\dev\OS.js\node_modules\grunt\lib\util\task.js:244:24)\n at Task. (C:\dev\OS.js\node_modules\grunt\lib\util\task.js:293:12)\n at Task.start (C: \dev\OS.js\node_modules\grunt\lib\util\task.js:302:5)\n at Object.grunt.tasks (C:\dev\OS.js\node_modules\grunt\lib\grunt.js:155:8)\n at Object.module.exports as cli\n at Object.<anonymou s> (C:\Users\vrspa\AppData\Roaming\nvm\v5.10.1\node_modules\grunt-cli\bin\grunt:44:20)\n at Module._compile (module.js:413:34)\n at Object.Module._extensions..js (module.js:422:10)\n at Module.load (module.js:357:32)\n at Function.Module._load (module.j s:314:12)\n at Function.Module.runMain (module.js:447:10)\n at startup (node.js:146:18)\n at node.js:404:3\n' \dist\osjs.css

andersevenrud commented 8 years ago

I'm not 100% sure what you mean here.

Is this a caching problem in the browser (as we spoke about in Gitter), or something else.

However, if 900-custom.json is changed to the following (removed src/ from core_custom.css line):

This would fail, beacuse the path is invalid.

VRspace4 commented 8 years ago

The path resolution appears to be different for grunt build script and OS.js. At the moment, I have 900-config.json with the following (without src/) because only then the custom style would work even with the error message from grunt core:

//900-custom.json
{
  "stylesheets": [
    "src/client/stylesheets/core.css",
    "src/client/stylesheets/gui.css",
    "client/dprm/themes/core_custom.css"
  ]
}
andersevenrud commented 8 years ago

I'll try this locally

andersevenrud commented 8 years ago

Your file is stored how exactly (path relative to OS.js) ?

VRspace4 commented 8 years ago

C:\dev\OS.js\src\client\dprm\themes\core_custom.css

andersevenrud commented 8 years ago

Do a pull, then set the file back to src/client/dprm/themes/core_custom.css and run

grunt core dist-files

VRspace4 commented 8 years ago

The update works. Thanks!

andersevenrud commented 8 years ago

Solved in 1a90bb7ca8228a9c468b8c0dffabc024866c0780

Sure thing!