Skip to content

Instantly share code, notes, and snippets.

View pawelgalazka's full-sized avatar

Paweł Gałązka pawelgalazka

View GitHub Profile
@pawelgalazka
pawelgalazka / Makefile
Created October 3, 2016 07:03
Example of Makefile (for medium article)
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
source_files := $(wildcard lib/*.coffee)
build_files := $(source_files:%.coffee=build/%.js)
template_source := templates/*.handlebars
template_js := build/templates.js
app_bundle := build/app.js
spec_coffee := $(wildcard spec/*.coffee)
spec_js := $(spec_coffee:%.coffee=build/%.js)
@pawelgalazka
pawelgalazka / package.json
Created October 3, 2016 07:01
Example of npm scripts
"scripts": {
"clean": "rimraf dist/*",
"prebuild": "npm run clean -s",
"build": "npm run build:scripts -s && npm run build:styles -s && npm run build:markup -s",
"build:scripts": "browserify -d assets/scripts/main.js -p [minifyify --compressPath . --map main.js.map --output dist/main.js.map] | hashmark -n dist/main.js -s -l 8 -m assets.json 'dist/{name}{hash}{ext}'",
"build:styles": "stylus assets/styles/main.styl -m -o dist/ && hashmark -s -l 8 -m assets.json dist/main.css 'dist/{name}{hash}{ext}'",
"build:markup": "jade assets/markup/index.jade --obj assets.json -o dist",
"test": "karma start --singleRun",
"watch": "parallelshell 'npm run watch:test -s' 'npm run watch:build -s'",
"watch:test": "karma start",
@pawelgalazka
pawelgalazka / structure.txt
Created October 3, 2016 06:53
Firenpm: generated directory structure
|- lib
|- src
| |- index.js
| |- index.test.js
|
|- config
| |- webpack.js
|
|- demo
| |- index.html
@pawelgalazka
pawelgalazka / index.js
Created October 3, 2016 06:51
Firenpm: react example for src/index.js
import React from 'react'
const MyComponent = () => {
return (
<div>Hello</div>
)
}
export default MyComponent
@pawelgalazka
pawelgalazka / index.js
Created October 3, 2016 06:49
Firenpm: react example for demo/index.js
import React from 'react'
import ReactDOM from 'react-dom'
import MyComponent from '../src'
import '../style.css'
document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(
<MyComponent />,
document.querySelector('#react-app')
)
@pawelgalazka
pawelgalazka / index.html
Created October 3, 2016 06:40
Firenpm: generated demo/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
<script src="bundle.js"></script>
</head>
<body>
<div id="react-app"></div>
</body>
@pawelgalazka
pawelgalazka / package.json
Last active October 3, 2016 06:41
Firenpm: generated package.json
{
"name": "test-project",
"version": "1.0.0",
"description": "",
"main": "lib/index.js",
"author": "",
"license": "MIT",
"scripts": {
"test": "run test"
},