1.2.1 • Published 6 years ago
@lunelson/penny v1.2.1
penny a zero-config on-the-fly-compiling dev server ...which also builds and is configurable
philosophy
- original idea was a local 'pen' (hence the name) server application for doing HTML/CSS/JS in any format with modern features
- also inspired by Harp.js idea, which got me in to jade/pug but eventually stopped maintainance
- but the powerful idea is something like "lazy static site generation": that is, in development you don't need to build out any static files, let alone continually build all the files (like most SSG setups do);
- but rather in development, where you spend most of your time, where you make constant changes and need to see constant updates, you build on-demand and on-the-fly via middleware, via browser request. This means you build only the resources currently being loaded in browsers.
- then later for production you build out all the files, with optional additional post-processing for some optimization.
CLI API
npm i @lunelson/pennypenny serve [source]penny build [source] [output]options
option object can be specified in one of the following places
- under
pennyproperty inpackage.json - in a
.pennyrcfile in JSON or YAML format - in a
penny.config.jsJavaScript file asmodule.exports(NB this format must be used for any of the plugin configuration options).
The following options are supported:
browsers: (see notes on declination of config file paths)include: same as jekyll optionexclude: same as jekyll optionkeepFiles: same as jekyll 'keep_files' optionbaseUrl: same as jekyll optionsubRoot: sub-folder of source, for alt structure; caveat: import/include is source-root-relative!browserSyncOptionsmarkdownItOptionsmarkdownItPlugins()posthtmlPlugins()postcssPlugins()
flags added internally
isDev: whether we are in dev modeisBuild: whether this is a build (as opposed to serve)
technical basis
- browsersync, connect
- pug, sass (node-sass, libsass), webpack
- postcss, posthtml
added functionality
- templates
- utility and helper libs in locals
- stylesheets
- custom functions to node-sass
- custom importer to node-sass
- javascripts
- webpack-loaders
dir structure and path references
- basic idea is to serve source as output; all non-src files pass through
- src files with .min.ext name pattern will be served without being processed
- alternative is to provide a 'public' subdirectory; caveat: src file references are still source-root-relative
- underscored files and directories are 'hidden' from being served or built (these are for import-/include-only files)
- markdown rendering is also supported, with additional rules
- any file without a 'layout' key in its front-matter will not be served or built
- any file with 'publish: false' in its front-matter will be served, but not built
import,@import,includeand helper function references in all file formats treat/folder/filereferences as source-root-relative
faq
- file name conflicts ?
- order is internally spec'd
npm install -g @lunelson/pennyPenny is not another bundler. It is an on-request in-memory-compiling live-reloading server for development, and a static-site builder for production. It avoids the pain of build-tool configuration, and the wasted time of full-site rebuilds.
- Pug.js, Libsass (via node-sass) and Babel/Webpack as view-engines
- Advanced helper functions incl. data-loading in templates and stylesheets
- Sourcemaps, file-watching and live-reloading in development; minification and purging in production
# given this structure...
# .
# ├── out
# └── src
# ├── index.pug
# ├── main.js
# └── main.scss
# run this to serve /src live on localhost:3000
penny serve src
# ...or run this to build from /src to /out...
penny build src out
# ...and get this structure
# .
# ├── out
# ├── index.html
# ├── main.js (es5)
# └── main.css
# └── src
# ├── index.pug
# ├── main.js (es6)
# └── main.scss2.0.0-alpha.15
6 years ago
2.0.0-alpha.14
6 years ago
2.0.0-alpha.13
6 years ago
2.0.0-alpha.12
6 years ago
2.0.0-alpha.11
7 years ago
2.0.0-alpha.10
7 years ago
2.0.0-alpha.9
7 years ago
2.0.0-alpha.8
7 years ago
2.0.0-alpha.7
7 years ago
2.0.0-alpha.6
7 years ago
2.0.0-alpha.5
7 years ago
2.0.0-alpha.4
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.8
7 years ago
1.1.7
7 years ago
1.1.6
7 years ago
1.1.5
8 years ago
1.1.4
8 years ago
1.1.3
8 years ago
1.1.2
8 years ago
1.1.1
8 years ago
1.1.0
8 years ago
1.0.0
8 years ago
0.9.0
8 years ago
0.8.1
8 years ago
0.8.0
8 years ago
0.0.8
8 years ago