Update generating code
This commit is contained in:
parent
755d7eb00e
commit
e8b6957003
@ -1,34 +0,0 @@
|
||||
# jekyll-algolia
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||
|
||||
- [Requirements](#requirements)
|
||||
- [Development](#development)
|
||||
- [Update docs](#update-docs)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Requirements
|
||||
|
||||
To run this project, you will need:
|
||||
|
||||
- Node.js >= v9.2.0, use nvm - [install instructions](https://github.com/creationix/nvm#install-script)
|
||||
- Yarn >= v1.3.2 - [install instructions](https://yarnpkg.com/en/docs/install#alternatives-tab)
|
||||
|
||||
## Development
|
||||
|
||||
```sh
|
||||
yarn
|
||||
yarn start
|
||||
```
|
||||
|
||||
Go to <http://localhost:3000>.
|
||||
|
||||
## Update docs
|
||||
|
||||
```sh
|
||||
yarn docs:update
|
||||
git push
|
||||
```
|
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present Algolia, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,106 +0,0 @@
|
||||
# jekyll-algolia
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||
|
||||
- [What is it](#what-is-it)
|
||||
- [Requirements](#requirements)
|
||||
- [Initial setup](#initial-setup)
|
||||
- [Publish docs to https://community.algolia.com/my-project](#publish-docs-to-httpscommunityalgoliacommy-project)
|
||||
- [Local development](#local-development)
|
||||
- [Test build](#test-build)
|
||||
- [Changes to be done before going live](#changes-to-be-done-before-going-live)
|
||||
- [Project structure](#project-structure)
|
||||
- [Assets and links references](#assets-and-links-references)
|
||||
- [Contributing](#contributing)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## What is it
|
||||
|
||||
A simple community boilerplate to replicate Algolia websites like InstantSearch*.
|
||||
|
||||
## Requirements
|
||||
|
||||
To run this project, you will need:
|
||||
|
||||
- Node.js >= v9.2.0, use nvm - [install instructions](https://github.com/creationix/nvm#install-script)
|
||||
- Yarn >= v1.3.2 - [install instructions](https://yarnpkg.com/en/docs/install#alternatives-tab)
|
||||
|
||||
## Initial setup
|
||||
|
||||
```sh
|
||||
git clone git@github.com:algolia/jekyll-algolia.git my-project
|
||||
cd my-project
|
||||
rm -rf .git
|
||||
git init
|
||||
git remote add origin git@github.com:algolia/my-project.git
|
||||
yarn
|
||||
yarn docs:update
|
||||
git add docs README.md CONTRIBUTING.md
|
||||
git commit -m 'first commit'
|
||||
git push
|
||||
```
|
||||
|
||||
## Publish docs to https://community.algolia.com/my-project
|
||||
|
||||
You need to activate GitHub pages for your repository (in settings on GitHub), choose "master branch /docs folder".
|
||||
|
||||
Every time you want to update your production website, do:
|
||||
|
||||
```sh
|
||||
yarn docs:update
|
||||
git add docs README.md CONTRIBUTING.md
|
||||
git commit -m 'docs(update): something'
|
||||
git push
|
||||
```
|
||||
|
||||
At some point this will be moved to Netlify.
|
||||
|
||||
## Local development
|
||||
|
||||
```sh
|
||||
yarn
|
||||
yarn start
|
||||
```
|
||||
|
||||
Go to https://localhost:3000. There should be auto reload for almost everything, but when it fails just restart the server.
|
||||
|
||||
## Test build
|
||||
|
||||
This will run the build of the website and serve it. Useful when you are modifying production middlewares and want to ensure
|
||||
the resulting website will be working. Like when adding CSS minification.
|
||||
|
||||
```sh
|
||||
yarn docs:test-build
|
||||
```
|
||||
|
||||
## Changes to be done before going live
|
||||
|
||||
- Rename any folder and replace any occurence of `jekyll-algolia` to `my-project`.
|
||||
- Remove `meta(name='ROBOTS', content='NOINDEX, NOFOLLOW')` from [src/layouts/common/meta.pug](./src/layouts/common/meta.pug).
|
||||
|
||||
## Project structure
|
||||
|
||||
- Pages (index, about..) are in [src/src](./src/src)
|
||||
- Layouts are in [src/layouts](./src/layouts)
|
||||
- JS and images are in [src/assets](./src/assets)
|
||||
- Stylesheets are in [src/src/stylesheets](./src/src/stylesheets)
|
||||
|
||||
## Assets and links references
|
||||
|
||||
To reference assets and links from any HTML page in this website, always reference them from the root of the website, without any leading "." or "/". Links from HTML pages are always relative to the root of your website, not the current file.
|
||||
|
||||
To ease hosting on different subpaths (https://community.algolia.com/website/ and http://localhost:3000/), we use a [`<base href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag that allow us to easily achieve that.
|
||||
|
||||
If your image is in `assets/images/image.png` then you can reference it in your HTML page like that: `<img src="assets/images/image.png" />` and it will always work no matter how the website is hosted.
|
||||
|
||||
Same for linking to a particular page, if you are in `index.html` (or `index.md`), to link to `about/team.html` just do this: `<a href="about/team.html">team</a>`.
|
||||
|
||||
For ressources inside CSS files, always use relative paths from the CSS file itself like `background-image: url("../assets/image/image.png")`);
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING](./CONTRIBUTING.md).
|
||||
|
@ -5,13 +5,13 @@ const path = require('path');
|
||||
const content = require('./src/data/communityHeader.json');
|
||||
const headerAlgoliaLogo = fs
|
||||
.readFileSync(
|
||||
path.join(__dirname, 'assets/images/algolia-logo-whitebg.svg'),
|
||||
path.join(__dirname, 'src/assets/images/algolia-logo-whitebg.svg'),
|
||||
'utf8'
|
||||
)
|
||||
.toString();
|
||||
const headerCommunityLogo = fs
|
||||
.readFileSync(
|
||||
path.join(__dirname, 'assets/images/algolia-community-dark.svg'),
|
||||
path.join(__dirname, 'src/assets/images/algolia-community-dark.svg'),
|
||||
'utf8'
|
||||
)
|
||||
.toString();
|
||||
@ -22,10 +22,10 @@ const header = algoliaComponents.communityHeader(content, {
|
||||
|
||||
const configs = {
|
||||
production: {
|
||||
docsDist: path.join(__dirname, '..', '..', 'docs'),
|
||||
docsDist: path.join(__dirname, '..', 'docs'),
|
||||
},
|
||||
development: {
|
||||
docsDist: path.join(__dirname, '..', '..', 'docs-dev'),
|
||||
docsDist: path.join(__dirname, '..', 'docs-dev'),
|
||||
},
|
||||
};
|
||||
|
@ -1,13 +1,15 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const metalsmith = require('metalsmith');
|
||||
const config = require('./config.js');
|
||||
const config = require('../config.js');
|
||||
const path = require('path');
|
||||
console.info(config.docsDist);
|
||||
|
||||
module.exports = function builder({ clean = true, middlewares }, cb) {
|
||||
console.time('metalsmith build');
|
||||
// default source directory is join(__dirname, 'src');
|
||||
// default source directory ./src
|
||||
// https://github.com/metalsmith/metalsmith#sourcepath
|
||||
metalsmith(__dirname)
|
||||
metalsmith(path.join(__dirname, '..'))
|
||||
.metadata(config)
|
||||
.clean(clean)
|
||||
.destination(config.docsDist)
|
@ -4,11 +4,11 @@
|
||||
|
||||
const webpack = require('webpack');
|
||||
const browserSync = require('browser-sync');
|
||||
const webpackConfig = require('./webpack.config.start');
|
||||
const webpackConfig = require('../webpack.config.start');
|
||||
const webpackDevMiddleware = require('webpack-dev-middleware');
|
||||
const webpackHotMiddleware = require('webpack-hot-middleware');
|
||||
const compression = require('compression');
|
||||
const config = require('./config.js');
|
||||
const config = require('../config.js');
|
||||
|
||||
module.exports = function() {
|
||||
const compiler = webpack(webpackConfig);
|
@ -10,14 +10,14 @@ const markdown = require('./plugins/markdown.js');
|
||||
const onlyChanged = require('./plugins/onlyChanged.js');
|
||||
const webpackEntryMetadata = require('./plugins/webpackEntryMetadata.js');
|
||||
const autoprefixer = require('./plugins/autoprefixer.js');
|
||||
const webpackStartConfig = require('./webpack.config.start.js');
|
||||
const webpackBuildConfig = require('./webpack.config.build.js');
|
||||
const webpackStartConfig = require('../webpack.config.start.js');
|
||||
const webpackBuildConfig = require('../webpack.config.build.js');
|
||||
|
||||
const common = [
|
||||
helpers,
|
||||
assets({
|
||||
source: './assets/',
|
||||
destination: './assets/',
|
||||
source: './src/assets',
|
||||
destination: 'assets',
|
||||
}),
|
||||
ignore(fileName => {
|
||||
// if it's a build js file, keep it (`build`)
|
||||
@ -70,6 +70,9 @@ module.exports = {
|
||||
rebase: false,
|
||||
},
|
||||
}),
|
||||
layouts('pug'),
|
||||
layouts({
|
||||
engine: 'pug',
|
||||
directory: 'src/layouts'
|
||||
}),
|
||||
],
|
||||
};
|
@ -3,7 +3,7 @@ const path = require('path');
|
||||
const glob = require('glob');
|
||||
const hasha = require('hasha');
|
||||
const replace = require('replace-in-file');
|
||||
const config = require('../config.js');
|
||||
const config = require('../../config.js');
|
||||
|
||||
const DIST_PATH = path.resolve(config.docsDist);
|
||||
|
@ -3,11 +3,8 @@
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=development node src/start.js",
|
||||
"docs:build": "NODE_ENV=production node src/build.js",
|
||||
"docs:update":
|
||||
"ROOT_PATH=/jekyll-algolia/ yarn docs:build && doctoc --maxlevel 2 README.md CONTRIBUTING.md",
|
||||
"docs:test-build": "ROOT_PATH=/ yarn docs:build && http-server docs/"
|
||||
"serve": "NODE_ENV=development node lib/start.js",
|
||||
"build": "NODE_ENV=production node lib/build.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"algolia-aerial": "1.2.6",
|
||||
|
@ -5,4 +5,4 @@ layout: single-column.pug
|
||||
|
||||
# Homepage
|
||||
|
||||
Hello
|
||||
Hello you
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user