Skip to content

Commit

Permalink
Merge PR #711: Remove Jade dependency
Browse files Browse the repository at this point in the history
Remove jade dependency
  • Loading branch information
koistya authored Jul 10, 2016
2 parents ef8b03d + 7456f47 commit 5155d62
Show file tree
Hide file tree
Showing 16 changed files with 187 additions and 235 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"graphql": "0.6.0",
"history": "3.0.0",
"isomorphic-style-loader": "1.0.0",
"jade": "1.11.0",
"jsonwebtoken": "7.0.0",
"markdown-it": "6.0.5",
"node-fetch": "1.5.3",
Expand Down Expand Up @@ -75,7 +74,6 @@
"gaze": "^1.0.0",
"git-repository": "^0.1.4",
"glob": "^7.0.3",
"jade-loader": "^0.8.0",
"json-loader": "^0.5.4",
"mkdirp": "^0.5.1",
"mocha": "^2.5.3",
Expand Down
6 changes: 4 additions & 2 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ let renderComplete = (state, callback) => {

// Google Analytics tracking. Don't send 'pageview' event after
// the initial rendering, as it was already sent
window.ga('send', 'pageview');
if (window.ga) {
window.ga('send', 'pageview');
}

callback(true);
};
Expand Down Expand Up @@ -109,7 +111,7 @@ function run() {
query: location.query,
state: location.state,
context,
render: render.bind(undefined, container, location.state),
render: render.bind(undefined, container, location.state), // eslint-disable-line react/jsx-no-bind, max-len
}).catch(err => console.error(err)); // eslint-disable-line no-console
}

Expand Down
42 changes: 42 additions & 0 deletions src/components/Html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React, { PropTypes } from 'react';
import { analytics } from '../config';

function Html({ title, description, style, script, children }) {
return (
<html className="no-js" lang="">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{title}</title>
<meta name="description" content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<style id="css" dangerouslySetInnerHTML={{ __html: style }} />
</head>
<body>
<div id="app" dangerouslySetInnerHTML={{ __html: children }} />
{script && <script src={script} />}
{analytics.google.trackingId &&
<script
dangerouslySetInnerHTML={{ __html:
'window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;' +
`ga('create','${analytics.google.trackingId}','auto');ga('send','pageview')` }}
/>
}
{analytics.google.trackingId &&
<script src="https://www.google-analytics.com/analytics.js" async defer />
}
</body>
</html>
);
}

Html.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
style: PropTypes.string.isRequired,
script: PropTypes.string,
children: PropTypes.string,
};

export default Html;
5 changes: 3 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

/* eslint-disable max-len */
/* jscs:disable maximumLineLength */

export const port = process.env.PORT || 3000;
export const host = process.env.WEBSITE_HOSTNAME || `localhost:${port}`;
Expand All @@ -18,7 +17,9 @@ export const databaseUrl = process.env.DATABASE_URL || 'sqlite:database.sqlite';
export const analytics = {

// https://analytics.google.com/
google: { trackingId: process.env.GOOGLE_TRACKING_ID || 'UA-XXXXX-X' },
google: {
trackingId: process.env.GOOGLE_TRACKING_ID, // UA-XXXXX-X
},

};

Expand Down
47 changes: 0 additions & 47 deletions src/content/about.jade

This file was deleted.

46 changes: 46 additions & 0 deletions src/content/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: About Us
component: ContentPage
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean consequat
tortor fermentum mi fermentum dignissim. Nullam vel ipsum ut ligula elementum
lobortis. Maecenas aliquam, massa laoreet lacinia pretium, nisi urna venenatis
tortor, nec imperdiet tellus libero efficitur metus. Fusce semper posuere
ligula, et facilisis metus bibendum interdum. Mauris at mauris sit amet sem
pharetra commodo a eu leo. Nam at est non risus cursus maximus. Nam feugiat
augue libero, id consectetur tortor bibendum non. Quisque nec fringilla lorem.
Nullam efficitur vulputate mauris, nec maximus leo dignissim id.

In hac habitasse platea dictumst. Duis sagittis dui ac ex suscipit maximus.
Morbi pellentesque venenatis felis sed convallis. Nulla varius, nibh vitae
placerat tempus, mauris sem elementum ipsum, eget sollicitudin nisl est vel
purus. Fusce malesuada odio velit, non cursus leo fermentum id. Cras pharetra
sodales fringilla. Etiam quis est a dolor egestas pellentesque. Maecenas non
scelerisque purus, congue cursus arcu. Donec vel dapibus mi. Mauris maximus
posuere placerat. Sed et libero eu nibh tristique mollis a eget lectus. Donec
interdum augue sollicitudin vehicula hendrerit. Vivamus justo orci, molestie
ac sollicitudin ac, lobortis at tellus. Etiam rhoncus ullamcorper risus eu
tempor. Sed porttitor, neque ac efficitur gravida, arcu lacus pharetra dui, in
consequat elit tellus auctor nulla. Donec placerat elementum diam, vitae
imperdiet lectus luctus at.

Nullam eu feugiat mi. Quisque nec tristique nisl, dignissim dictum leo. Nam
non quam nisi. Donec rutrum turpis ac diam blandit, id pulvinar mauris
suscipit. Pellentesque tincidunt libero ultricies risus iaculis, sit amet
consequat velit blandit. Fusce quis varius nulla. Nullam nisi nisi, suscipit
ut magna quis, feugiat porta nibh. Sed id enim lectus. Suspendisse elementum
justo sapien, sit amet consequat orci accumsan et. Aliquam ornare ullamcorper
sem sed finibus. Nullam ac lacus pulvinar, egestas felis ut, accumsan est.

Pellentesque sagittis vehicula sem quis luctus. Proin sodales magna in lorem
hendrerit aliquam. Integer eu varius orci. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at mauris
nibh. Suspendisse maximus ac eros at vestibulum.

Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque egestas
tortor et dui consequat faucibus. Nunc vitae odio ornare, venenatis ligula a,
vulputate nisl. Aenean congue varius ex, sit amet bibendum odio posuere at.
Nulla facilisi. In finibus, nulla vitae tincidunt ornare, sapien nulla
fermentum mauris, sed consectetur tortor arcu eget arcu. Vestibulum vel quam
enim.
22 changes: 0 additions & 22 deletions src/content/index.jade

This file was deleted.

19 changes: 19 additions & 0 deletions src/content/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: React.js Starter Kit
component: ContentPage
---
### Runtime Components

[React](https://facebook.github.io/react/) - A JavaScript library for building user interfaces, developed by Facebook

[Flux](http://facebook.github.io/flux/) - Application architecture for building user interfaces

### Development Tools

[Webpack](http://webpack.github.io/) - Compiles front-end source code into modules / bundles

[BrowserSync](http://www.browsersync.io/) - A lightweight HTTP server for development

### Fork me on GitHub

[github.com/kriasoft/react-starter-kit](https://github.com/kriasoft/react-starter-kit)
52 changes: 0 additions & 52 deletions src/content/privacy.jade

This file was deleted.

46 changes: 46 additions & 0 deletions src/content/privacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Privacy Policy
component: ContentPage
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean consequat
tortor fermentum mi fermentum dignissim. Nullam vel ipsum ut ligula elementum
lobortis. Maecenas aliquam, massa laoreet lacinia pretium, nisi urna venenatis
tortor, nec imperdiet tellus libero efficitur metus. Fusce semper posuere
ligula, et facilisis metus bibendum interdum. Mauris at mauris sit amet sem
pharetra commodo a eu leo. Nam at est non risus cursus maximus. Nam feugiat
augue libero, id consectetur tortor bibendum non. Quisque nec fringilla lorem.
Nullam efficitur vulputate mauris, nec maximus leo dignissim id.

In hac habitasse platea dictumst. Duis sagittis dui ac ex suscipit maximus.
Morbi pellentesque venenatis felis sed convallis. Nulla varius, nibh vitae
placerat tempus, mauris sem elementum ipsum, eget sollicitudin nisl est vel
purus. Fusce malesuada odio velit, non cursus leo fermentum id. Cras pharetra
sodales fringilla. Etiam quis est a dolor egestas pellentesque. Maecenas non
scelerisque purus, congue cursus arcu. Donec vel dapibus mi. Mauris maximus
posuere placerat. Sed et libero eu nibh tristique mollis a eget lectus. Donec
interdum augue sollicitudin vehicula hendrerit. Vivamus justo orci, molestie
ac sollicitudin ac, lobortis at tellus. Etiam rhoncus ullamcorper risus eu
tempor. Sed porttitor, neque ac efficitur gravida, arcu lacus pharetra dui, in
consequat elit tellus auctor nulla. Donec placerat elementum diam, vitae
imperdiet lectus luctus at.

Nullam eu feugiat mi. Quisque nec tristique nisl, dignissim dictum leo. Nam
non quam nisi. Donec rutrum turpis ac diam blandit, id pulvinar mauris
suscipit. Pellentesque tincidunt libero ultricies risus iaculis, sit amet
consequat velit blandit. Fusce quis varius nulla. Nullam nisi nisi, suscipit
ut magna quis, feugiat porta nibh. Sed id enim lectus. Suspendisse elementum
justo sapien, sit amet consequat orci accumsan et. Aliquam ornare ullamcorper
sem sed finibus. Nullam ac lacus pulvinar, egestas felis ut, accumsan est.

Pellentesque sagittis vehicula sem quis luctus. Proin sodales magna in lorem
hendrerit aliquam. Integer eu varius orci. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at mauris
nibh. Suspendisse maximus ac eros at vestibulum.

Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque egestas
tortor et dui consequat faucibus. Nunc vitae odio ornare, venenatis ligula a,
vulputate nisl. Aenean congue varius ex, sit amet bibendum odio posuere at.
Nulla facilisi. In finibus, nulla vitae tincidunt ornare, sapien nulla
fermentum mauris, sed consectetur tortor arcu eget arcu. Vestibulum vel quam
enim.
8 changes: 2 additions & 6 deletions src/data/queries/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import fs from 'fs';
import { join } from 'path';
import Promise from 'bluebird';
import jade from 'jade';
import fm from 'front-matter';
import MarkdownIt from 'markdown-it';

Expand All @@ -23,17 +22,14 @@ import ContentType from '../types/ContentType';

const md = new MarkdownIt();

// A folder with Jade/Markdown/HTML content pages
// A folder with Markdown/HTML content pages
const CONTENT_DIR = join(__dirname, './content');

// Extract 'front matter' metadata and generate HTML
const parseContent = (path, fileContent, extension) => {
const fmContent = fm(fileContent);
let htmlContent;
switch (extension) {
case '.jade':
htmlContent = jade.render(fmContent.body);
break;
case '.md':
htmlContent = md.render(fmContent.body);
break;
Expand Down Expand Up @@ -73,7 +69,7 @@ async function resolveExtension(path, extension) {
}

async function resolveFileName(path) {
const extensions = ['.jade', '.md', '.html'];
const extensions = ['.md', '.html'];

for (const extension of extensions) {
const maybeFileName = await resolveExtension(path, extension);
Expand Down
6 changes: 4 additions & 2 deletions src/routes/error/ErrorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './ErrorPage.css';

function ErrorPage({ error }, context) {
export function ErrorPage({ error }, context) {
let title = 'Error';
let content = 'Sorry, a critical error occurred on this page.';
let errorMessage = null;
Expand All @@ -23,7 +23,9 @@ function ErrorPage({ error }, context) {
errorMessage = <pre>{error.stack}</pre>;
}

context.setTitle(title);
if (context.setTitle) {
context.setTitle(title);
}

return (
<div>
Expand Down
Loading

0 comments on commit 5155d62

Please sign in to comment.