Prepare for v2, s/markup/html/g in code blocks
This commit is contained in:
parent
20f0759103
commit
b580e241c8
6 changed files with 58 additions and 57 deletions
81
.travis.yml
81
.travis.yml
|
|
@ -28,46 +28,47 @@ script:
|
||||||
- npm run perf
|
- npm run perf
|
||||||
|
|
||||||
# After a successful build commit changes back to repo
|
# After a successful build commit changes back to repo
|
||||||
after_success:
|
# Disable per https://github.com/MithrilJS/mithril.js/issues/2417
|
||||||
- |
|
# after_success:
|
||||||
# Set up SSH environment
|
# - |
|
||||||
$(npm bin)/set-up-ssh \
|
# # Set up SSH environment
|
||||||
--key "$encrypted_016049456622_key" \
|
# $(npm bin)/set-up-ssh \
|
||||||
--iv "$encrypted_016049456622_iv" \
|
# --key "$encrypted_016049456622_key" \
|
||||||
--path-encrypted-key "./.deploy.enc"
|
# --iv "$encrypted_016049456622_iv" \
|
||||||
|
# --path-encrypted-key "./.deploy.enc"
|
||||||
# Commit bundle changes generated in before_script step
|
#
|
||||||
# --commands is a weird no-op but required for commit-changes to run
|
# # Commit bundle changes generated in before_script step
|
||||||
# --branch arg is to ensure this only runs against the `next` branch
|
# # --commands is a weird no-op but required for commit-changes to run
|
||||||
$(npm bin)/commit-changes \
|
# # --branch arg is to ensure this only runs against the `next` branch
|
||||||
--commands "echo committing" \
|
# $(npm bin)/commit-changes \
|
||||||
--commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
|
# --commands "echo committing" \
|
||||||
--branch "next"
|
# --commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
|
||||||
|
# --branch "next"
|
||||||
# Only want to commit docs when building pushes on master &
|
#
|
||||||
# this doesn't have the built-in branch protection like commit-changes
|
# # Only want to commit docs when building pushes on master &
|
||||||
if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
|
# # this doesn't have the built-in branch protection like commit-changes
|
||||||
[ "$TRAVIS_BRANCH" == "master" ] && \
|
# if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
|
||||||
[ "$TRAVIS_REPO_SLUG" == "MithrilJS/mithril.js" ]
|
# [ "$TRAVIS_BRANCH" == "master" ] && \
|
||||||
then
|
# [ "$TRAVIS_REPO_SLUG" == "MithrilJS/mithril.js" ]
|
||||||
# Generate docs
|
# then
|
||||||
npm run gendocs
|
# # Generate docs
|
||||||
|
# npm run gendocs
|
||||||
# Set up git env
|
#
|
||||||
git config --global user.email "$GH_USER_EMAIL"
|
# # Set up git env
|
||||||
git config --global user.name "$GH_USER_NAME"
|
# git config --global user.email "$GH_USER_EMAIL"
|
||||||
|
# git config --global user.name "$GH_USER_NAME"
|
||||||
# Commit docs to gh-pages branch
|
#
|
||||||
# Using --add to ensure that archived versions aren't lost
|
# # Commit docs to gh-pages branch
|
||||||
# Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
|
# # Using --add to ensure that archived versions aren't lost
|
||||||
$(npm bin)/gh-pages \
|
# # Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
|
||||||
--dist ./dist \
|
# $(npm bin)/gh-pages \
|
||||||
--add \
|
# --dist ./dist \
|
||||||
--repo "git@github.com:MithrilJS/mithril.js.git" \
|
# --add \
|
||||||
--message "Generated docs for commit $TRAVIS_COMMIT [skip ci]"
|
# --repo "git@github.com:MithrilJS/mithril.js.git" \
|
||||||
else
|
# --message "Generated docs for commit $TRAVIS_COMMIT [skip ci]"
|
||||||
echo "Not submitting documentation updates"
|
# else
|
||||||
fi
|
# echo "Not submitting documentation updates"
|
||||||
|
# fi
|
||||||
|
|
||||||
# Environment configuration
|
# Environment configuration
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,9 @@ An easy way to try out Mithril is to include it from a CDN and follow this tutor
|
||||||
|
|
||||||
Let's create an HTML file to follow along:
|
Let's create an HTML file to follow along:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<body>
|
<body>
|
||||||
<script src="https://unpkg.com/mithril@next/mithril.js"></script>
|
<script src="https://unpkg.com/mithril/mithril.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var root = document.body
|
var root = document.body
|
||||||
|
|
||||||
|
|
@ -173,7 +173,7 @@ m.mount(root, Hello)
|
||||||
|
|
||||||
As you would expect, doing so creates this markup:
|
As you would expect, doing so creates this markup:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<main>
|
<main>
|
||||||
<h1 class="title">My first app</h1>
|
<h1 class="title">My first app</h1>
|
||||||
<button>A button</button>
|
<button>A button</button>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
If you're new to JavaScript or just want a very simple setup to get your feet wet, you can get Mithril from a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network):
|
If you're new to JavaScript or just want a very simple setup to get your feet wet, you can get Mithril from a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network):
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<script src="https://unpkg.com/mithril@next/mithril.js"></script>
|
<script src="https://unpkg.com/mithril/mithril.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -18,7 +18,7 @@ If you're new to JavaScript or just want a very simple setup to get your feet we
|
||||||
### NPM
|
### NPM
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm install mithril@next --save
|
$ npm install mithril --save
|
||||||
```
|
```
|
||||||
|
|
||||||
TypeScript type definitions are available from DefinitelyTyped. They can be installed with:
|
TypeScript type definitions are available from DefinitelyTyped. They can be installed with:
|
||||||
|
|
@ -46,7 +46,7 @@ $ npm init --yes
|
||||||
|
|
||||||
2. install required tools
|
2. install required tools
|
||||||
```bash
|
```bash
|
||||||
$ npm install mithril@next --save
|
$ npm install mithril --save
|
||||||
$ npm install webpack webpack-cli --save-dev
|
$ npm install webpack webpack-cli --save-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ npm init --yes
|
||||||
Then, to install Mithril, run:
|
Then, to install Mithril, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install mithril@next --save
|
npm install mithril --save
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create a folder called `node_modules`, and a `mithril` folder inside of it. It will also add an entry under `dependencies` in the `package.json` file
|
This will create a folder called `node_modules`, and a `mithril` folder inside of it. It will also add an entry under `dependencies` in the `package.json` file
|
||||||
|
|
@ -148,7 +148,7 @@ npm start
|
||||||
|
|
||||||
Now that you have created a bundle, you can then reference the `bin/app.js` file from an HTML file:
|
Now that you have created a bundle, you can then reference the `bin/app.js` file from an HTML file:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Hello world</title>
|
<title>Hello world</title>
|
||||||
|
|
@ -220,7 +220,7 @@ Live reload is a feature where code changes automatically trigger the page to re
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1) install
|
# 1) install
|
||||||
npm install mithril@next --save
|
npm install mithril --save
|
||||||
npm install budo -g
|
npm install budo -g
|
||||||
|
|
||||||
# 2) add this line into the scripts section in package.json
|
# 2) add this line into the scripts section in package.json
|
||||||
|
|
@ -255,13 +255,13 @@ If you want to try it and give feedback, you can open `package.json` and change
|
||||||
|
|
||||||
If you don't have the ability to run a bundler script due to company security policies, there's an options to not use a module system at all:
|
If you don't have the ability to run a bundler script due to company security policies, there's an options to not use a module system at all:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Hello world</title>
|
<title>Hello world</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="https://unpkg.com/mithril@next/mithril.js"></script>
|
<script src="https://unpkg.com/mithril/mithril.js"></script>
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ Let's develop a simple application that shows off how to do most of the major th
|
||||||
|
|
||||||
First let's create an entry point for the application. Create a file `index.html`:
|
First let's create an entry point for the application. Create a file `index.html`:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
@ -217,7 +217,7 @@ The `m.mount` call renders the specified component (`UserList`) into a DOM eleme
|
||||||
|
|
||||||
Right now, the list looks rather plain because we have not defined any styles. So let's add a few of them. Let's first create a file called `styles.css` and include it in the `index.html` file:
|
Right now, the list looks rather plain because we have not defined any styles. So let's add a few of them. Let's first create a file called `styles.css` and include it in the `index.html` file:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ var Stream = require("mithril/stream")
|
||||||
|
|
||||||
You can also download the module directly if your environment does not support a bundling toolchain:
|
You can also download the module directly if your environment does not support a bundling toolchain:
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<script src="https://unpkg.com/mithril@next/stream/stream.js"></script>
|
<script src="https://unpkg.com/mithril/stream/stream.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
When loaded directly with a `<script>` tag (rather than required), the stream library will be exposed as `window.m.stream`. If `window.m` is already defined (e.g. because you also use the main Mithril script), it will attach itself to the existing object. Otherwise it creates a new `window.m`. If you want to use streams in conjunction with Mithril as raw script tags, you should include Mithril in your page before `mithril/stream`, because `mithril` will otherwise overwrite the `window.m` object defined by `mithril/stream`. This is not a concern when the libraries are consumed as CommonJS modules (using `require(...)`).
|
When loaded directly with a `<script>` tag (rather than required), the stream library will be exposed as `window.m.stream`. If `window.m` is already defined (e.g. because you also use the main Mithril script), it will attach itself to the existing object. Otherwise it creates a new `window.m`. If you want to use streams in conjunction with Mithril as raw script tags, you should include Mithril in your page before `mithril/stream`, because `mithril` will otherwise overwrite the `window.m` object defined by `mithril/stream`. This is not a concern when the libraries are consumed as CommonJS modules (using `require(...)`).
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ One common way to misuse `m.trust` is when working with third party services who
|
||||||
|
|
||||||
Here's the example snippet for the [Facebook Like button](https://developers.facebook.com/docs/plugins/like-button):
|
Here's the example snippet for the [Facebook Like button](https://developers.facebook.com/docs/plugins/like-button):
|
||||||
|
|
||||||
```markup
|
```html
|
||||||
<!-- Load Facebook SDK for JavaScript -->
|
<!-- Load Facebook SDK for JavaScript -->
|
||||||
<div id="fb-root"></div>
|
<div id="fb-root"></div>
|
||||||
<script>(function(d, s, id) {
|
<script>(function(d, s, id) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue