Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Commit

Permalink
Initial import with working poc for loading images
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoojala committed Jan 14, 2016
0 parents commit 260d7b6
Show file tree
Hide file tree
Showing 42 changed files with 754 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# OS directory cache files
Thumbs.db
.DS_Store

# npm
/node_modules/*
!/node_modules/testi-projekti

npm-debug.log

# Built sources
dist
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

## Webpack asset bundling proof-of-concept test

Based on <https://github.com/patrikholcak/webpack-demo>, which in turn is based on <https://github.com/css-modules/webpack-demo>

## Run the example

```bash
$ npm install
$ npm start & open http://localhost:8080
```

## License

[MIT]
18 changes: 18 additions & 0 deletions hot-reload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server'),
config = require('./webpack.config'),
host = 'localhost',
port = 8080;


var server = new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
});

server.listen(port, host, function (err, result) {
if (err) console.err(err)

console.log("Listening at %s:%s", host, port)
});
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>CSS Modules Webpack Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
<div id="outlet"></div>
<script src="/index.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions node_modules/testi-projekti/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added node_modules/testi-projekti/giraffe.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions node_modules/testi-projekti/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions node_modules/testi-projekti/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions node_modules/testi-projekti/webpack.config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "webpack-demo",
"description": "Working demo of CSS Modules, using Webpack's css-loader in module mode.",
"version": "1.0.0",
"private": true,
"license": "MIT",
"main": "index.js",
"homepage": "https://github.com/css-modules/webpack-demo",
"author": "Mark Dalgleish",
"contributors": [
"Patrik Holcak <[email protected]> (http://holcak.com)"
],
"bugs": {
"url": "https://github.com/css-modules/webpack-demo/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/css-modules/webpack-demo"
},
"devDependencies": {
"babel-core": "^5.8.25",
"babel-loader": "^5.3.2",
"css-loader": "^0.19.0",
"file-loader": "^0.8.4",
"postcss-loader": "^0.6.0",
"raw-loader": "^0.5.1",
"react-hot-loader": "^1.3.0",
"style-loader": "^0.12.4",
"url-loader": "^0.5.6",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
},
"scripts": {
"start": "node hot-reload.js",
"deploy": "npm run build && gh-pages -d dist -m \"Updates --skip-ci\""
},
"dependencies": {
"react": "^0.13.3"
}
}
6 changes: 6 additions & 0 deletions src/components/0-Logo/Logo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.logo {
background: url('./logo.svg');
background-size: 200px 200px;
width: 200px;
height: 200px;
}
9 changes: 9 additions & 0 deletions src/components/0-Logo/Logo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React, {Component} from 'react';
import styles from './Logo.css';


export default class Logo extends Component {
render() {
return <div className={styles.logo} />;
}
};
28 changes: 28 additions & 0 deletions src/components/0-Logo/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/components/1-ScopedSelectors/ScopedSelectors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.root {
border-width: 2px;
border-style: solid;
border-color: #777;
padding: 0 20px;
margin: 0 6px;
max-width: 400px;
}

.text {
color: #777;
font-size: 24px;
font-family: helvetica, arial, sans-serif;
font-weight: 600;
}
13 changes: 13 additions & 0 deletions src/components/1-ScopedSelectors/ScopedSelectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, {Component} from 'react';
import styles from './ScopedSelectors.css';


export default class ScopedSelectors extends Component {
render() {
return (
<div className={ styles.root }>
<p className={ styles.text }>Scoped Selectors</p>
</div>
);
}
};
24 changes: 24 additions & 0 deletions src/components/1-ScopedSelectors/ScopedSelectorsDemo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import ScopedSelectors from './ScopedSelectors';

import React, { Component } from 'react';

import js from '!!raw!./ScopedSelectors.js';
import css from '!!raw!./ScopedSelectors.css';
import Snippet from 'shared/Snippet/Snippet';

export default class ScopedSelectorsDemo extends Component {

render() {
const files = [
{ name: 'ScopedSelectors.js', source: js },
{ name: 'ScopedSelectors.css', source: css }
];

return (
<Snippet files={files}>
<ScopedSelectors />
</Snippet>
);
}

};
15 changes: 15 additions & 0 deletions src/components/2-GlobalSelectors/GlobalSelectors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.root {
border-width: 2px;
border-style: solid;
border-color: brown;
padding: 0 20px;
margin: 0 6px;
max-width: 400px;
}

.root :global .text {
color: brown;
font-size: 24px;
font-family: helvetica, arial, sans-serif;
font-weight: 600;
}
13 changes: 13 additions & 0 deletions src/components/2-GlobalSelectors/GlobalSelectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, {Component} from 'react';
import styles from './GlobalSelectors.css';


export default class GlobalSelectors extends Component {
render() {
return (
<div className={ styles.root }>
<p className="text">Global Selectors</p>
</div>
);
}
};
24 changes: 24 additions & 0 deletions src/components/2-GlobalSelectors/GlobalSelectorsDemo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import GlobalSelectors from './GlobalSelectors';

import React, { Component } from 'react';

import js from '!!raw!./GlobalSelectors.js';
import css from '!!raw!./GlobalSelectors.css';
import Snippet from 'shared/Snippet/Snippet';

export default class GlobalSelectorsDemo extends Component {

render() {
const files = [
{ name: 'GlobalSelectors.js', source: js },
{ name: 'GlobalSelectors.css', source: css }
];

return (
<Snippet files={files}>
<GlobalSelectors />
</Snippet>
);
}

};
16 changes: 16 additions & 0 deletions src/components/3-ClassComposition/ClassComposition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, {Component} from 'react';

import StyleVariantA from './StyleVariantA/StyleVariantA';
import StyleVariantB from './StyleVariantB/StyleVariantB';

export default class ClassComposition extends Component {
render() {
return (
<div>
<StyleVariantA />
<br />
<StyleVariantB />
</div>
);
}
};
Loading

0 comments on commit 260d7b6

Please sign in to comment.