segmentio/myth — 4.3k★ trên GitHub (JavaScript). A CSS preprocessor that acts like a polyfill for future versions of the spec.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Myth is a preprocessor that lets you write pure CSS without having to worry about slow browser support, or even slow spec approval. It's like a CSS polyfill.
Installation
$ npm install -g myth
Usage
$ myth input.css output.css
# Generated output.css from input.css
Community
mnmly/builder-myth: component-builder plugin
gulp-myth: Gulp plugin
grunt-myth: Grunt plugin
duo-myth: Duo plugin
myth-loader: Webpack Loader
meteor-myth: Meteor plugin
myth-transformer: Dart transformer
Why?
Myth lets you write pure CSS while still giving you the benefits of tools like LESS and Sass. You can still use variables and math functions, just like you do in preprocessors. It's like a polyfill for future versions of the spec.
Some of the features in CSS require runtime calculations, which neither Myth nor preprocessors handle, but what Myth does is let you write your code today in the future syntax, so that your code is future-proof. When browsers finally support these features you won't need to rewrite anything, just start using the cascade!
Taking plain CSS as an input also means you can use Myth to re-process anyone else's CSS (or another preprocessors output), adding the browser support you need, without having to re-write the code in a completely different syntax.
Myth is built with Rework so it's incredibly fast, and has a nice Javascript API in addition to the CLI.
Example
An example is the easiest way to explain it. If you write spec-compliant CSS:
The prefixes from the most-common and most-recent browsers are supported, so you never need to worry about what the current browser support landscape is. Big thanks to autoprefixer!
4-digit and 8-digit hex color support. Spec - Thanks
Font-variant shorthands. Spec - Thanks
API
Command Line
Usage: myth [<input>] [<output>]
Options:
-h, --help output usage information
-V, --version output the version number
-c, --compress compress output
-w, --watch watch the input file for changes
-s, --sourcemap add source map
-v, --verbose log verbose output for debugging
--no-import disable import support
--no-variables disable variables support
--no-custom-media disable custom media support
--no-hex-alpha disable hex alpha support
--no-color disable color support
--no-calc disable calc support
--no-font-variant disable font variant support
--no-rebeccapurple disable rebeccapurple support
--no-prefixes disable prefixes support
Examples:
# pass an input and output file:
$ myth input.css output.css
# watch the input file for changes:
$ myth --watch input.css output.css
# unix-style piping to stdin and stdout:
$ cat input.css | myth | grep background-color
Node.js
var myth = require('myth');
var fs = require('fs');
var css = fs.readFileSync('index.css', 'utf8');
var converted = myth(css);
fs.writeFileSync('converted.css', converted);
Or use it directly as a Rework plugin:
var myth = require('myth');
var rework = require('rework');
var fs = require('fs');
var css = fs.readFileSync('index.css', 'utf8');
var converted = rework(css)
.use(myth())
.toString();
fs.writeFileSync('converted.css', converted);
Available options:
Key
Type
Description
browsers
Array
An array of browsers and versions to support.
compress
Boolean
Whether to compress the CSS output.
features
Object
A dictionary of features to disable. All features are enabled by default. Available features: calc, color, customMedia, fontVariant, hexAlpha, import, prefixes, rebeccapurple, variables.
preserve
Boolean
Whether to preserve variables in the output.
source
String
The full path to the source CSS file. This is required if you want Myth to concatenate @import rules in your CSS.
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.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/segmentio/myth là nguồn chính thức.
segmentio/myth có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho segmentio/myth. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
segmentio/myth là gì?
segmentio/myth (segmentio/myth) là dự án JavaScript trên GitHub. Theo mô tả gốc: A CSS preprocessor that acts like a polyfill for future versions of the spec.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về myth?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về myth.