Skip to content

Update NPM packages #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/src/front.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import hook from '../../register';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';

if (typeof document !== 'undefined') {
React.render(<App />, document.getElementById('outlet'));
ReactDOM.render(<App />, document.getElementById('outlet'));
}
5,549 changes: 5,549 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -25,28 +25,30 @@
},
"homepage": "https://github.com/kenpowers/css-modules-electron#readme",
"devDependencies": {
"auto-plug": "^1.1.0",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.0",
"auto-plug": "^1.2.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-object-rest-spread": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-register": "^6.18.0",
"babel-register": "^6.26.0",
"del": "^1.2.1",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.2",
"gulp-cached": "^1.1.0",
"gulp-run-electron": "^1.2.1",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.0",
"gulp-cached": "^1.1.1",
"gulp-run-electron": "^3.0.1",
"in-publish": "^2.0.0",
"postcss": "^4.1.16",
"postcss-modules-extract-imports": "0.0.5",
"postcss-modules-local-by-default": "0.0.12",
"postcss-modules-scope": "0.0.8",
"react": "^0.13.3"
"postcss": "^6.0.0",
"postcss-modules-extract-imports": "^1.1.0",
"postcss-modules-local-by-default": "^1.2.0",
"postcss-modules-scope": "^1.1.0",
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"dependencies": {
"css-modules-require-hook": "^1.0.10",
"postcss-url": "^4.0.1"
"css-modules-require-hook": "^4.2.2",
"electron": "^1.7.9",
"postcss-url": "^7.1.2"
}
}
11 changes: 6 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import hook from 'css-modules-require-hook';
import { remote } from 'electron';
import path from 'path';

var root = remote.app.getAppPath();
const { app } = remote;
const rootDir = app.getAppPath();

/**
* Calls css-modules-require-hook with some extra options.
@@ -12,13 +13,13 @@ var root = remote.app.getAppPath();
export default function(args = {}) {
hook({
...args,
root: root,
rootDir,
append: [
...(args.append || []),
// Rewrite css urls
require('postcss-url')({
url: function (url, decl, from, dirname, to, options, result) {
return path.join(root, dirname, url);
url: function (asset, dir, options, decl, warn, result) {
return asset.absolutePath;
}
})
],
@@ -29,7 +30,7 @@ export default function(args = {}) {
if (!document || !document.head) {
return css;
}
var style = document.createElement('style');
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
document.head.appendChild(style);