mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Replaced all occurrences of npm with yarn
This commit is contained in:
parent
acf74131cc
commit
a58904c8c2
@ -26,5 +26,5 @@ CHANGED="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
|
|||||||
# Perform install and prune of NPM dependencies if package.json changed
|
# Perform install and prune of NPM dependencies if package.json changed
|
||||||
if $(echo "$CHANGED" | grep --quiet package.json); then
|
if $(echo "$CHANGED" | grep --quiet package.json); then
|
||||||
echo -e "\x1B[33m!\x1B[0m Updating dependencies"
|
echo -e "\x1B[33m!\x1B[0m Updating dependencies"
|
||||||
npm install && npm prune
|
yarn install
|
||||||
fi
|
fi
|
||||||
|
@ -57,7 +57,7 @@ if [ "$FILES" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If flow terminated with errors, abort commit
|
# If flow terminated with errors, abort commit
|
||||||
npm run flow --silent > /dev/null
|
yarn run flow --silent
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
echo -e "\x1B[31m✗\x1B[0m Flow - \x1B[31m$MESSAGE\x1B[0m"
|
echo -e "\x1B[31m✗\x1B[0m Flow - \x1B[31m$MESSAGE\x1B[0m"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -174,7 +174,8 @@ theme and recompile it. This is fairly easy.
|
|||||||
### Environment setup
|
### Environment setup
|
||||||
|
|
||||||
In order to start development on the Material theme, a [Node.js][8] version of
|
In order to start development on the Material theme, a [Node.js][8] version of
|
||||||
at least 4 is required. Clone the repository from GitHub:
|
at least 5 is required, as well as the package manager [yarn][9] which is a
|
||||||
|
better version of `npm`. First, clone the repository:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
git clone https://github.com/squidfunk/mkdocs-material
|
git clone https://github.com/squidfunk/mkdocs-material
|
||||||
@ -185,23 +186,24 @@ Next, all dependencies need to be installed, which is done with:
|
|||||||
``` sh
|
``` sh
|
||||||
cd mkdocs-material
|
cd mkdocs-material
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
npm install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
[8]: https://nodejs.org
|
[8]: https://nodejs.org
|
||||||
|
[9]: https://yarnpkg.com/
|
||||||
|
|
||||||
### Development mode
|
### Development mode
|
||||||
|
|
||||||
The Material theme uses a sophisticated asset pipeline using [Gulp][9] and
|
The Material theme uses a sophisticated asset pipeline using [Gulp][10] and
|
||||||
Webpack which can be started with the following command:
|
Webpack which can be started with the following command:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
npm start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
This will also start the MkDocs development server which will monitor changes
|
This will also start the MkDocs development server which will monitor changes
|
||||||
on assets, templates and documentation. Point your browser to
|
on assets, templates and documentation. Point your browser to
|
||||||
[localhost:8000][10] and you should see this documentation in front of you.
|
[localhost:8000][11] and you should see this documentation in front of you.
|
||||||
|
|
||||||
For example, changing the color palette is as simple as changing the
|
For example, changing the color palette is as simple as changing the
|
||||||
`$md-color-primary` and `$md-color-accent` variables in
|
`$md-color-primary` and `$md-color-accent` variables in
|
||||||
@ -218,15 +220,15 @@ $md-color-accent: $clr-teal-a700;
|
|||||||
directory are automatically generated from the `src` directory and will be
|
directory are automatically generated from the `src` directory and will be
|
||||||
overriden when the theme is built.
|
overriden when the theme is built.
|
||||||
|
|
||||||
[9]: http://gulpjs.com
|
[10]: http://gulpjs.com
|
||||||
[10]: http://localhost:8000
|
[11]: http://localhost:8000
|
||||||
|
|
||||||
### Build process
|
### Build process
|
||||||
|
|
||||||
When you finished making your changes, you can build the theme by invoking:
|
When you finished making your changes, you can build the theme by invoking:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
npm run build
|
yarn run build
|
||||||
```
|
```
|
||||||
|
|
||||||
This triggers the production-level compilation and minification of all
|
This triggers the production-level compilation and minification of all
|
||||||
|
@ -4,13 +4,21 @@
|
|||||||
and is included in the standard Markdown library. The highlighting process is
|
and is included in the standard Markdown library. The highlighting process is
|
||||||
executed during compilation of the Markdown file.
|
executed during compilation of the Markdown file.
|
||||||
|
|
||||||
|
!!! fail "Syntax highlighting not working?"
|
||||||
|
|
||||||
|
Please ensure that [Pygments][2] is installed. See the next section for
|
||||||
|
further directions on how to set up Pygments or use the official
|
||||||
|
[Docker image][3] with all dependencies pre-installed.
|
||||||
|
|
||||||
[1]: https://pythonhosted.org/Markdown/extensions/code_hilite.html
|
[1]: https://pythonhosted.org/Markdown/extensions/code_hilite.html
|
||||||
|
[2]: http://pygments.org
|
||||||
|
[3]: https://hub.docker.com/r/squidfunk/mkdocs-material/
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
CodeHilite parses code blocks and wraps them in `<pre>` tags. If [Pygments][2]
|
CodeHilite parses code blocks and wraps them in `<pre>` tags. If [Pygments][2]
|
||||||
is installed, which is a generic syntax highlighter with support for over
|
is installed, which is a generic syntax highlighter with support for over
|
||||||
[300 languages][3], CodeHilite will also highlight the code block. Pygments can
|
[300 languages][4], CodeHilite will also highlight the code block. Pygments can
|
||||||
be installed with the following command:
|
be installed with the following command:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
@ -32,8 +40,7 @@ markdown_extensions:
|
|||||||
that and defines styles for the default `.codehilite` class, so the part
|
that and defines styles for the default `.codehilite` class, so the part
|
||||||
`css_class=code` needs to be removed.
|
`css_class=code` needs to be removed.
|
||||||
|
|
||||||
[2]: http://pygments.org
|
[4]: http://pygments.org/languages
|
||||||
[3]: http://pygments.org/languages
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
pre-installed and ready-to-use with the latest version published on PyPI,
|
pre-installed and ready-to-use with the latest version published on PyPI,
|
||||||
packaged in a very small image (28MB compressed).
|
packaged in a very small image (28MB compressed).
|
||||||
|
|
||||||
|
[1]: https://hub.docker.com/r/squidfunk/mkdocs-material/
|
||||||
|
|
||||||
### Installing MkDocs
|
### Installing MkDocs
|
||||||
|
|
||||||
Before installing [MkDocs][2], you need to make sure you have Python and `pip`
|
Before installing [MkDocs][2], you need to make sure you have Python and `pip`
|
||||||
@ -40,7 +42,6 @@ pip install pygments
|
|||||||
pip install pymdown-extensions
|
pip install pymdown-extensions
|
||||||
```
|
```
|
||||||
|
|
||||||
[1]: https://hub.docker.com/r/squidfunk/mkdocs-material/
|
|
||||||
[2]: http://www.mkdocs.org
|
[2]: http://www.mkdocs.org
|
||||||
[3]: http://pygments.org
|
[3]: http://pygments.org
|
||||||
[4]: http://facelessuser.github.io/pymdown-extensions/
|
[4]: http://facelessuser.github.io/pymdown-extensions/
|
||||||
|
@ -42,6 +42,8 @@ extra:
|
|||||||
primary: indigo
|
primary: indigo
|
||||||
accent: indigo
|
accent: indigo
|
||||||
social:
|
social:
|
||||||
|
- type: globe
|
||||||
|
link: http://struct.cc
|
||||||
- type: github-alt
|
- type: github-alt
|
||||||
link: https://github.com/squidfunk
|
link: https://github.com/squidfunk
|
||||||
- type: twitter
|
- type: twitter
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
$(npm bin)/gulp build --clean --optimize --revision "$@"
|
$(yarn bin)/gulp build --clean --optimize --revision "$@"
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
$(npm bin)/gulp clean "$@"
|
$(yarn bin)/gulp clean "$@"
|
||||||
|
10
scripts/flow
10
scripts/flow
@ -20,19 +20,19 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Annotate source files
|
# Annotate source files
|
||||||
$(npm bin)/gulp assets:javascripts:annotate "$@"
|
$(yarn bin)/gulp assets:javascripts:annotate "$@"
|
||||||
FLOW_JSDOC=$?
|
FLOW_JSDOC=$?
|
||||||
|
|
||||||
# Run flow typecheck
|
# Run flow typecheck
|
||||||
$(npm bin)/flow check tmp
|
$(yarn bin)/flow check tmp
|
||||||
FLOW=$?
|
FLOW=$?
|
||||||
|
|
||||||
# If one command failed, exit with error
|
# If one command failed, exit with error
|
||||||
|
10
scripts/lint
10
scripts/lint
@ -20,19 +20,19 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run ESLint
|
# Run ESLint
|
||||||
$(npm bin)/eslint --max-warnings 0 .
|
$(yarn bin)/eslint --max-warnings 0 .
|
||||||
ESLINT=$?
|
ESLINT=$?
|
||||||
|
|
||||||
# Run Stylelint
|
# Run Stylelint
|
||||||
$(npm bin)/stylelint `find src/assets -name *.scss`
|
$(yarn bin)/stylelint `find src/assets -name *.scss`
|
||||||
STYLELINT=$?
|
STYLELINT=$?
|
||||||
|
|
||||||
# If one command failed, exit with error
|
# If one command failed, exit with error
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
$(npm bin)/gulp clean && \
|
$(yarn bin)/gulp clean && \
|
||||||
$(npm bin)/gulp watch --no-lint "$@"
|
$(yarn bin)/gulp watch --no-lint "$@"
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
$(npm bin)/gulp tests:visual:run --clean --no-optimize "$@"
|
$(yarn bin)/gulp tests:visual:run --clean --no-optimize "$@"
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
$(npm bin)/gulp tests:visual:session "$@"
|
$(yarn bin)/gulp tests:visual:session "$@"
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
# IN THE SOFTWARE.
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
# Check if "npm install" was executed
|
# Check if "yarn install" was executed
|
||||||
if [[ ! -d $(npm bin) ]]; then
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
echo "\"node_modules\" not found:"
|
echo "\"node_modules\" not found:"
|
||||||
echo "npm install"
|
echo "yarn install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run command
|
# Run command
|
||||||
$(npm bin)/gulp tests:visual:update "$@"
|
$(yarn bin)/gulp tests:visual:update "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user