Fix: remove egg-info folders and update .gitignore

This commit is contained in:
Silvio Rhatto 2023-01-18 16:22:29 -03:00
parent b70018ac87
commit 141f6b5717
No known key found for this signature in database
GPG Key ID: 0B67F75BCEE634FB
28 changed files with 1 additions and 887 deletions

9
.gitignore vendored
View File

@ -2,11 +2,4 @@
__pycache__
*.pyc
.egg*
/packages/txt-to-html/lektor_txt_to_html.egg-info/
/packages/xml-to-html/lektor_xml_to_html.egg-info/
/packages/environs/environs.egg-info/PKG-INFO
/packages/envvars/lektor_envvars.egg-info/PKG-INFO
/packages/envvars/lektor_envvars.egg-info/entry_points.txt
/packages/i18n/lektor_i18n.egg-info/PKG-INFO
/packages/i18n/lektor_i18n.egg-info/SOURCES.txt
/packages/i18n/lektor_i18n.egg-info/entry_points.txt
packages/**/*.egg-info

View File

@ -1,454 +0,0 @@
Metadata-Version: 2.1
Name: environs
Version: 8.0.0
Summary: simplified environment variable parsing
Home-page: https://github.com/sloria/environs
Author: Steven Loria
Author-email: sloria1@gmail.com
License: MIT
Project-URL: Issues, https://github.com/sloria/environs/issues
Project-URL: Changelog, https://github.com/sloria/environs/blob/master/CHANGELOG.md
Description: # environs: simplified environment variable parsing
[![Latest version](https://badgen.net/pypi/v/environs)](https://pypi.org/project/environs/)
[![Build Status](https://dev.azure.com/sloria/sloria/_apis/build/status/sloria.environs?branchName=master)](https://dev.azure.com/sloria/sloria/_build/latest?definitionId=12&branchName=master)
[![marshmallow 2/3 compatible](https://badgen.net/badge/marshmallow/2,3?list=1)](https://marshmallow.readthedocs.io/en/latest/upgrading.html)
[![Black code style](https://badgen.net/badge/code%20style/black/000)](https://github.com/ambv/black)
**environs** is a Python library for parsing environment variables.
It allows you to store configuration separate from your code, as per
[The Twelve-Factor App](https://12factor.net/config) methodology.
## Contents
- [Features](#features)
- [Install](#install)
- [Basic usage](#basic-usage)
- [Supported types](#supported-types)
- [Reading .env files](#reading-env-files)
- [Reading a specific file](#reading-a-specific-file)
- [Handling prefixes](#handling-prefixes)
- [Proxied variables](#proxied-variables)
- [Validation](#validation)
- [Deferred validation](#deferred-validation)
- [Serialization](#serialization)
- [Defining custom parser behavior](#defining-custom-parser-behavior)
- [Usage with Flask](#usage-with-flask)
- [Usage with Django](#usage-with-django)
- [Why...?](#why)
- [Why envvars?](#why-envvars)
- [Why not os.environ?](#why-not-osenviron)
- [Why another library?](#why-another-library)
- [License](#license)
## Features
- Type-casting
- Read `.env` files into `os.environ` (useful for local development)
- Validation
- Define custom parser behavior
- Framework-agnostic, but integrates well with [Flask](#usage-with-flask) and [Django](#usage-with-django)
## Install
pip install environs
## Basic usage
With some environment variables set...
```bash
export GITHUB_USER=sloria
export MAX_CONNECTIONS=100
export SHIP_DATE='1984-06-25'
export TTL=42
export ENABLE_LOGIN=true
export GITHUB_REPOS=webargs,konch,ped
export COORDINATES=23.3,50.0
export LOG_LEVEL=DEBUG
```
Parse them with environs...
```python
from environs import Env
env = Env()
env.read_env() # read .env file, if it exists
# required variables
gh_user = env("GITHUB_USER") # => 'sloria'
secret = env("SECRET") # => raises error if not set
# casting
max_connections = env.int("MAX_CONNECTIONS") # => 100
ship_date = env.date("SHIP_DATE") # => datetime.date(1984, 6, 25)
ttl = env.timedelta("TTL") # => datetime.timedelta(0, 42)
log_level = env.log_level("LOG_LEVEL") # => logging.DEBUG
# providing a default value
enable_login = env.bool("ENABLE_LOGIN", False) # => True
enable_feature_x = env.bool("ENABLE_FEATURE_X", False) # => False
# parsing lists
gh_repos = env.list("GITHUB_REPOS") # => ['webargs', 'konch', 'ped']
coords = env.list("COORDINATES", subcast=float) # => [23.3, 50.0]
```
## Supported types
The following are all type-casting methods of `Env`:
- `env.str`
- `env.bool`
- `env.int`
- `env.float`
- `env.decimal`
- `env.list` (accepts optional `subcast` keyword argument)
- `env.dict` (accepts optional `subcast` keyword argument)
- `env.json`
- `env.datetime`
- `env.date`
- `env.timedelta` (assumes value is an integer in seconds)
- `env.url`
- `env.uuid`
- `env.log_level`
- `env.path` (casts to a [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html))
## Reading `.env` files
```bash
# .env
DEBUG=true
PORT=4567
```
Call `Env.read_env` before parsing variables.
```python
from environs import Env
env = Env()
# Read .env into os.environ
env.read_env()
env.bool("DEBUG") # => True
env.int("PORT") # => 4567
```
### Reading a specific file
By default, `Env.read_env` will look for a `.env` file in current
directory and (if no .env exists in the CWD) recurse
upwards until a `.env` file is found.
You can also read a specific file:
```python
from environs import Env
with open(".env.test", "w") as fobj:
fobj.write("A=foo\n")
fobj.write("B=123\n")
env = Env()
env.read_env(".env.test", recurse=False)
assert env("A") == "foo"
assert env.int("B") == 123
```
## Handling prefixes
```python
# export MYAPP_HOST=lolcathost
# export MYAPP_PORT=3000
with env.prefixed("MYAPP_"):
host = env("HOST", "localhost") # => 'lolcathost'
port = env.int("PORT", 5000) # => 3000
# nested prefixes are also supported:
# export MYAPP_DB_HOST=lolcathost
# export MYAPP_DB_PORT=10101
with env.prefixed("MYAPP_"):
with env.prefixed("DB_"):
db_host = env("HOST", "lolcathost")
db_port = env.int("PORT", 10101)
```
## Proxied variables
```python
# export MAILGUN_LOGIN=sloria
# export SMTP_LOGIN={{MAILGUN_LOGIN}}
smtp_login = env("SMTP_LOGIN") # =>'sloria'
```
## Validation
```python
# export TTL=-2
# export NODE_ENV='invalid'
# export EMAIL='^_^'
from environs import Env
from marshmallow.validate import OneOf, Length, Email
env = Env()
# simple validator
env.int("TTL", validate=lambda n: n > 0)
# => Environment variable "TTL" invalid: ['Invalid value.']
# using marshmallow validators
env.str(
"NODE_ENV",
validate=OneOf(
["production", "development"], error="NODE_ENV must be one of: {choices}"
),
)
# => Environment variable "NODE_ENV" invalid: ['NODE_ENV must be one of: production, development']
# multiple validators
env.str("EMAIL", validate=[Length(min=4), Email()])
# => Environment variable "EMAIL" invalid: ['Shorter than minimum length 4.', 'Not a valid email address.']
```
## Deferred validation
By default, a validation error is raised immediately upon calling a parser method for an invalid environment variable.
To defer validation and raise an exception with the combined error messages for all invalid variables, pass `eager=False` to `Env`.
Call `env.seal()` after all variables have been parsed.
```python
# export TTL=-2
# export NODE_ENV='invalid'
# export EMAIL='^_^'
from environs import Env
from marshmallow.validate import OneOf, Email, Length, Range
env = Env(eager=False)
TTL = env.int("TTL", validate=Range(min=0, max=100))
NODE_ENV = env.str(
"NODE_ENV",
validate=OneOf(
["production", "development"], error="NODE_ENV must be one of: {choices}"
),
)
EMAIL = env.str("EMAIL", validate=[Length(min=4), Email()])
env.seal()
# environs.EnvValidationError: Environment variables invalid: {'TTL': ['Must be greater than or equal to 0 and less than or equal to 100.'], 'NODE_ENV': ['NODE_ENV must be one of: production, development'], 'EMAIL': ['Shorter than minimum length 4.', 'Not a valid email address.']}
```
`env.seal()` validates all parsed variables and prevents further parsing (calling a parser method will raise an error).
## Serialization
```python
# serialize to a dictionary of simple types (numbers and strings)
env.dump()
# {'COORDINATES': [23.3, 50.0],
# 'ENABLE_FEATURE_X': False,
# 'ENABLE_LOGIN': True,
# 'GITHUB_REPOS': ['webargs', 'konch', 'ped'],
# 'GITHUB_USER': 'sloria',
# 'MAX_CONNECTIONS': 100,
# 'MYAPP_HOST': 'lolcathost',
# 'MYAPP_PORT': 3000,
# 'SHIP_DATE': '1984-06-25',
# 'TTL': 42}
```
## Defining custom parser behavior
```python
# export DOMAIN='http://myapp.com'
# export COLOR=invalid
from furl import furl
# Register a new parser method for paths
@env.parser_for("furl")
def furl_parser(value):
return furl(value)
domain = env.furl("DOMAIN") # => furl('https://myapp.com')
# Custom parsers can take extra keyword arguments
@env.parser_for("enum")
def enum_parser(value, choices):
if value not in choices:
raise environs.EnvError("Invalid!")
return value
color = env.enum("COLOR", choices=["black"]) # => raises EnvError
```
## Usage with Flask
```python
# myapp/settings.py
from environs import Env
env = Env()
env.read_env()
# Override in .env for local development
DEBUG = env.bool("FLASK_DEBUG", default=False)
# SECRET_KEY is required
SECRET_KEY = env.str("SECRET_KEY")
```
Load the configuration after you initialize your app.
```python
# myapp/app.py
from flask import Flask
app = Flask(__name__)
app.config.from_object("myapp.settings")
```
For local development, use a `.env` file to override the default
configuration.
```bash
# .env
DEBUG=true
SECRET_KEY="not so secret"
```
Note: Because environs depends on [python-dotenv](https://github.com/theskumar/python-dotenv),
the `flask` CLI will automatically read .env and .flaskenv files.
## Usage with Django
environs includes a number of helpers for parsing connection URLs. To
install environs with django support:
pip install environs[django]
Use `env.dj_db_url`, `env.dj_cache_url` and `env.dj_email_url` to parse the `DATABASE_URL`, `CACHE_URL`
and `EMAIL_URL` environment variables, respectively.
For more details on URL patterns, see the following projects that environs is using for converting URLs.
* [dj-database-url](https://github.com/jacobian/dj-database-url)
* [django-cache-url](https://github.com/epicserve/django-cache-url)
* [dj-email-url](https://github.com/migonzalvar/dj-email-url)
Basic example:
```python
# myproject/settings.py
from environs import Env
env = Env()
env.read_env()
# Override in .env for local development
DEBUG = env.bool("DEBUG", default=False)
# SECRET_KEY is required
SECRET_KEY = env.str("SECRET_KEY")
# Parse database URLs, e.g. "postgres://localhost:5432/mydb"
DATABASES = {"default": env.dj_db_url("DATABASE_URL")}
# Parse email URLs, e.g. "smtp://"
email = env.dj_email_url("EMAIL_URL", default="smtp://")
EMAIL_HOST = email["EMAIL_HOST"]
EMAIL_PORT = email["EMAIL_PORT"]
EMAIL_HOST_PASSWORD = email["EMAIL_HOST_PASSWORD"]
EMAIL_HOST_USER = email["EMAIL_HOST_USER"]
EMAIL_USE_TLS = email["EMAIL_USE_TLS"]
# Parse cache URLS, e.g "redis://localhost:6379/0"
CACHES = {"default": env.dj_cache_url("CACHE_URL")}
```
For local development, use a `.env` file to override the default
configuration.
```bash
# .env
DEBUG=true
SECRET_KEY="not so secret"
```
For a more complete example, see
[django_example.py](https://github.com/sloria/environs/blob/master/examples/django_example.py)
in the `examples/` directory.
## Why\...?
### Why envvars?
See [The 12-factor App](http://12factor.net/config) section on
[configuration](http://12factor.net/config).
### Why not `os.environ`?
While `os.environ` is enough for simple use cases, a typical application
will need a way to manipulate and validate raw environment variables.
environs abstracts common tasks for handling environment variables.
environs will help you
- cast envvars to the correct type
- specify required envvars
- define default values
- validate envvars
- parse list and dict values
- parse dates, datetimes, and timedeltas
- parse proxied variables
- serialize your configuration to JSON, YAML, etc.
### Why another library?
There are many great Python libraries for parsing environment variables.
In fact, most of the credit for environs\' public API goes to the
authors of [envparse](https://github.com/rconradharris/envparse) and
[django-environ](https://github.com/joke2k/django-environ).
environs aims to meet three additional goals:
1. Make it easy to extend parsing behavior and develop plugins.
2. Leverage the deserialization and validation functionality provided
by a separate library (marshmallow).
3. Clean up redundant API.
See [this GitHub
issue](https://github.com/rconradharris/envparse/issues/12#issue-151036722)
which details specific differences with envparse.
## License
MIT licensed. See the
[LICENSE](https://github.com/sloria/environs/blob/master/LICENSE) file
for more details.
Keywords: environment variables parsing config configuration 12factor envvars
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Typing :: Typed
Requires-Python: >=3.5.3
Description-Content-Type: text/markdown

View File

@ -1,16 +0,0 @@
CHANGELOG.md
CONTRIBUTING.md
LICENSE
MANIFEST.in
README.md
pyproject.toml
setup.cfg
setup.py
environs/__init__.py
environs/py.typed
environs.egg-info/PKG-INFO
environs.egg-info/SOURCES.txt
environs.egg-info/dependency_links.txt
environs.egg-info/not-zip-safe
environs.egg-info/requires.txt
environs.egg-info/top_level.txt

View File

@ -1,2 +0,0 @@
marshmallow>=2.7.0
python-dotenv

View File

@ -1 +0,0 @@
environs

View File

@ -1,106 +0,0 @@
Metadata-Version: 1.1
Name: lektor-envvars
Version: 18.6.12.4
Summary: A Lektor plugin making environment variables available in templates.
Home-page: https://www.github.com/elbaschid/lektor-envvars
Author: Sebastian Vetter
Author-email: seb@roadsi.de
License: MIT
Description: lektor-envvars
##############
.. image:: https://circleci.com/gh/elbaschid/lektor-envvars.svg?style=svg
:target: https://circleci.com/gh/elbaschid/lektor-envvars
Why this project?
-----------------
**TL;DR** You can use environment variables in your Lektor templates.
I've been working with `Lektor <https://www.getlektor.com/docs/plugins/>`_ as as
static site generator in quite a few projects and really enjoy it. Most recently
I work on a project that used an environment variable to create slightly
different version of the site for ``development``, ``staging`` and ``production``.
Lektor doesn't have a way to add *environment variables* into the templates, so
I started building my own little plugin.
How to install it in Lektor
---------------------------
You can easily install this plugin following the `Lektor docs
<https://www.getlektor.com/docs/plugins/>`_. All you need to do is run::
$ lektor plugin add lektor-envvars
This will automatically install the plugin and add it to your project
configuration.
Using environment variables
---------------------------
You are able to access environment variables using the ``envvars`` function
inside your Jinja2 template. This function is added whenever lektor is running
a new build.
All environment variables are prefixed with ``LEKTOR_`` by default. Let's look
at a simple example with an environment varialbe ``LEKTOR_DEBUG=true``::
$ export LEKTOR_DEBUG=true
You can access this variable inside any Jinja2 template::
{{ envvars('DEBUG') }}
which will display ``true`` instead.
Converting values
-----------------
That's a great start but what if you want this to be a boolean value instead of
the string ``true``? You simply convert the value::
{{ envvars('DEBUG', bool) }}
or you can now even do::
{% if envvars('DEBUG', bool) %}
...
{% endif %}
Custom prefixes (or no prefix)
------------------------------
If you don't like the ``LEKTOR_`` prefix, you can either use your own prefix by
setting the prefix in the ``configs/lektor-envvars.ini`` file::
[envvars]
prefix = MY_OWN_
You can now use ``MY_OWN_DEBUG`` instead of ``LEKTOR_DEBUG``. This means that
all environment variables need to be prefixed with ``MY_OWN_`` now instead.
You can also ignore the prefix all together::
{{ envvars('DEBUG', no_prefix=True) }}
which will give you access to the environment variable ``DEBUG``.
License
-------
This code is licensed under the `MIT License`_.
.. _`MIT License`: https://github.com/elbaschid/lektor-envvars/blob/master/LICENSE
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython

View File

@ -1,11 +0,0 @@
LICENSE
MANIFEST.in
README.rst
lektor_envvars.py
setup.cfg
setup.py
lektor_envvars.egg-info/PKG-INFO
lektor_envvars.egg-info/SOURCES.txt
lektor_envvars.egg-info/dependency_links.txt
lektor_envvars.egg-info/entry_points.txt
lektor_envvars.egg-info/top_level.txt

View File

@ -1,3 +0,0 @@
[lektor.plugins]
envvars = lektor_envvars:EnvvarsPlugin

View File

@ -1 +0,0 @@
lektor_envvars

View File

@ -1,10 +0,0 @@
Metadata-Version: 1.0
Name: lektor-i18n
Version: 0.2
Summary: UNKNOWN
Home-page: https://github.com/numericube/lektor-i18n-plugin
Author: NumeriCube
Author-email: support@numericube.com
License: GPL
Description: UNKNOWN
Platform: UNKNOWN

View File

@ -1,8 +0,0 @@
README
lektor_i18n.py
setup.py
lektor_i18n.egg-info/PKG-INFO
lektor_i18n.egg-info/SOURCES.txt
lektor_i18n.egg-info/dependency_links.txt
lektor_i18n.egg-info/entry_points.txt
lektor_i18n.egg-info/top_level.txt

View File

@ -1,3 +0,0 @@
[lektor.plugins]
i18n = lektor_i18n:I18NPlugin

View File

@ -1 +0,0 @@
lektor_i18n

View File

@ -1,94 +0,0 @@
Metadata-Version: 2.1
Name: lektor-scss
Version: 1.4.1
Summary: Lektor plugin to compile css out of sass - based on libsass
Home-page: https://github.com/chaos-bodensee/lektor-scss.git
Author: L3D
Author-email: l3d@c3woc.de
License: MIT
Keywords: Lektor plugin
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Lektor
Classifier: Environment :: Plugins
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
License-File: LICENSE
SCSS compiler for lektor
=============================
[![PyPI version](https://badge.fury.io/py/lektor-scss.svg)](https://badge.fury.io/py/lektor-scss)
[![Downloads](https://pepy.tech/badge/lektor-scss)](https://pepy.tech/project/lektor-scss)
![Upload Python Package](https://github.com/chaos-bodensee/lektor-scss/workflows/Upload%20Python%20Package/badge.svg)
![Linting Python package](https://github.com/chaos-bodensee/lektor-scss/workflows/Linting%20Python%20package/badge.svg)
SCSS compiler for [Lektor](https://getlektor.com) that compiles css from sass.
How does it actually work?
----------------------------
+ It uses [libsass](https://github.com/sass/libsass-python)
+ It looks for ``.scss`` and ``.sass`` files *(ignores part files that begin with a underscore e.g. '_testfile.scss') and compiles them as part of the build process.*
+ It only rebuilds the css when it's needed (file changed, a file it imports changed or the config changed).
+ When starting the the development server it watches the files for changes in the background and rebuilds them when needed.
Installation
-------------
You can install the plugin with Lektor's installer:
```bash
lektor plugins add lektor-scss
```
Or by hand, adding the plugin to the packages section in your lektorproject file:
```ini
[packages]
lektor-scss = 1.4.1
```
Usage
------
To enable the plugin, pass the ``scss`` flag when starting the development
server or when running a build:
```bash
# build and compile css from scss
lektor build -f scss
# edit site with new generated css
lektor server -f scss
```
Python3
----------
It is highly recommended to use this plugin with a python3 version of lektor.
Since lektor can be used as a python module it is possible to enforce this *(after lektor is installed eg. with ``pip3 install --user --upgrade lektor``)* with the following command:
```bash
# run a python3 lektor server with new generated css
python3 -m lektor server -f scss
```
Configuration
-------------
The Plugin has the following settings you can adjust to your needs:
|parameter |default value |description |
|---------------|-------------------|--------------------------------------------------------------------------------------------------|
|source_dir |assets/scss/ | the directory in which the plugin searchs for sass files (subdirectories are included) |
|output_dir |assets/css/ | the directory the compiled css files get place at |
|output_style |compressed | coding style of the compiled result. choose one of: 'nested', 'expanded', 'compact', 'compressed'|
|source_comments|False | whether to add comments about source lines |
|precision |5 | precision for numbers |
|include_paths | |If you want to include SASS libraries from a different directory, libsass's compile function has a parameter called `include_paths` to add those directories to the search path. |
An example file with the default config can be found at ``configs/scss.ini``. For every parameter that is not specified in the config file the default value is used by the plugin.
Development
-------------
To test and/or develop on this plugin in your running lektor installation, simply place it in the ``packages/`` Folder and have a look at the [Lektor Doku](https://www.getlektor.com/docs/plugins/dev/)
<!-- How to add to pypi: https://packaging.python.org/tutorials/packaging-projects/ -->
<!-- Python RELEASEING moved to github action -->
<!-- You have to edit the version number in README and setup.py manually -->

View File

@ -1,10 +0,0 @@
LICENSE
README.md
lektor_scss.py
setup.py
lektor_scss.egg-info/PKG-INFO
lektor_scss.egg-info/SOURCES.txt
lektor_scss.egg-info/dependency_links.txt
lektor_scss.egg-info/entry_points.txt
lektor_scss.egg-info/requires.txt
lektor_scss.egg-info/top_level.txt

View File

@ -1,3 +0,0 @@
[lektor.plugins]
scss = lektor_scss:scssPlugin

View File

@ -1,2 +0,0 @@
libsass==0.21.0
termcolor

View File

@ -1 +0,0 @@
lektor_scss

View File

@ -1,131 +0,0 @@
Metadata-Version: 2.1
Name: lektor-npm-support
Version: 0.1.4
Summary: Adds support for using npm/yarn to build assets in Lektor
Home-page: http://github.com/sterin/lektor-npm-support
Author: Baruch Sterin
Author-email: lektor-npm-support@bsterin.com
License: BSD
Description: # lektor-npm-support
[![Build Status](https://travis-ci.org/sterin/lektor-npm-support.svg)](https://travis-ci.org/sterin/lektor-npm-support)
[![Build status](https://ci.appveyor.com/api/projects/status/6op1csefpi9l8hbg?svg=true)](https://ci.appveyor.com/project/sterin/lektor-npm-support)
[![Code Coverage](https://codecov.io/gh/sterin/lektor-npm-support/branch/master/graph/badge.svg)](https://codecov.io/gh/sterin/lektor-npm-support)
`lektor-npm-support` makes it easy to use [Parcel](https://parcel.js.org), [webpack](https://webpack.js.org), [browserify](http://browserify.org/), or any other tool to build assets for [Lektor](https://github.com/lektor/lektor) projects.
## Enabling the Plugin
To enable the plugin, run this command while inside your Lektor project directory:
```bash
lektor plugins add lektor-npm-support
```
## Example: Creating a [Parcel](https://parceljs.org/) Project
Create a `parcel/` folder and inside that folder create the following files:
### `configs/npm-support.ini`
This file instructs the plugin how to generate the assets:
```ini
[parcel]
npm = yarn
watch_script = watch
build_script = build
```
* The section name `[parcel]` is the name of the folder where the Parcel project is located.
* `npm` is the package manager command used to build the project. This example will use [Yarn](https://yarnpkg.com).
* `watch_script` is the npm script used in `lektor server -f npm`,
* `build_script` is the npm script used in `lektor build -f npm`.
This plugin supports more than one such entry.
### `parcel/package.json`
This is a standard `package.json` file. It should contain two entries in the `scripts` section. The `build` script is used during `lektor build -f npm`, and the `watch` script is used during `lektor server -f npm`.
```json
{
"name": "my-parcel-project",
"version": "1.0.0",
"scripts": {
"watch": "NODE_ENV=development parcel --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js",
"build": "NODE_ENV=production parcel build --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js"
},
"private": true
}
```
Now we can use `yarn add` to add Parcel, [Babel](https://babeljs.io/) and [Sass](https://sass-lang.com/):
```
$ cd </path/to/your/lektor/project>/parcel
$ yarn add parcel-bundler babel-preset-env node-sass
```
### `parcel/babelr.rc`
Next up is a simple Babel config file, using the recommended `env` preset.
```json
{
"presets": ["env"]
}
```
### `parcel/main.scss`
A simple SCSS file.
```scss
body {
border: 10px solid red;
}
```
### `parcel/main.js`
A simple Javascript file that imports the SCSS file so that Parcel will know to include it as well.
```javascript
import './main.scss';
```
## Running the Server
Now you're ready to go. When you run `lektor server` nothing wil happen,
instead you need to now run it as `lektor server -f npm` which
will enable the Parcel build. Parcel will automatically build your files
into `assets/static/gen` and this is where Lektor will then pick up the
files. This is done so that you can ship the generated assets
to others that might not have these tools, which simplifies using a
Lektor website that use this plugin.
## Manual Builds
To manually trigger a build that also invokes webpack you can use `lektor build -f npm`.
## Including The Files
Now you need to include the files in your template. This will do it:
```html
<link rel="stylesheet" href="{{ '/static/gen/main.css'| asseturl }}">
<script type=text/javascript src="{{ '/static/gen/main.js'| asseturl }}" charset="utf-8"></script>
```
## Complete Working Example
The `examples` folder of this repository contains working projects.
## Credits
This plugin is based on the official [lektor-webpack-support](https://github.com/lektor/lektor-webpack-support) Lektor plugin by [Armin Ronacher](http://lucumr.pocoo.org/about/).
Platform: UNKNOWN
Description-Content-Type: text/markdown

View File

@ -1,12 +0,0 @@
CHANGELOG.md
LICENSE.md
MANIFEST.in
README.md
lektor_npm_support.py
setup.cfg
setup.py
lektor_npm_support.egg-info/PKG-INFO
lektor_npm_support.egg-info/SOURCES.txt
lektor_npm_support.egg-info/dependency_links.txt
lektor_npm_support.egg-info/entry_points.txt
lektor_npm_support.egg-info/top_level.txt

View File

@ -1,3 +0,0 @@
[lektor.plugins]
npm-support = lektor_npm_support:NPMSupportPlugin

View File

@ -1 +0,0 @@
lektor_npm_support