Modernizr/customizr hiện có 64 sao trên GitHub, viết chủ yếu bằng JavaScript. Build out a lean, mean Modernizr machine.
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.
tl;dr: This tool crawls through your project files, gathers up your references to Modernizr tests and outputs a lean, mean Modernizr machine.
customizr is a Modernizr builder for your project. It is based on the Modernizr team's Modulizr tool.
This configurable task allows you to configure and export a custom Modernizr build. Use Modernizr's annotated source for development, and let this tool worry about optimization.
When you're ready to build, customizr will crawl your project for Modernizr test references and save out a minified, uglified, customized version using only the tests you've used in your JavaScript or (S)CSS.
Example
CSS / SCSS / LESS
When going through css files, the crawler will not look for display: flex but rather if the code contains a css selector that is named like the Modernizr properties
.flexbox {
...
}
or
.no-flexbox {
...
}
Javascript
When going through javascript files, the crawler will look for Modernizr calls like this one:
if (!Modernizr.flexbox) {
...
}
Use with Grunt
A Grunt wrapper is available at: https://github.com/Modernizr/grunt-modernizr
Use with Gulp
A Gulp wrapper is available at: https://github.com/Modernizr/gulp-modernizr
Getting Started
Install with npm: npm install --save customizr
Documentation
Command Line
./node-modules/.bin/customizr -c path/to/config
Command Line Options
-h, --help # Print options and usage
-v, --version # Print the version number
-c, --config # Path to your Modernizr config JSON file
-f, --force # Ignore cached versions and force build Modernizr
Config File
A sample config file is below. Default values shown:
{
// Avoid unnecessary builds (see Caching section below)
"cache" : true,
// Path to the build you're using for development.
"devFile" : false,
// Path to save out the built file
"dest" : false,
// Based on default settings on http://modernizr.com/download/
"options" : [
"addTest",
"html5printshiv",
"testProp"
],
// By default, the build process is verbose
"quiet" : false,
// By default, source is uglified before saving
"uglify" : true,
// Define any tests you want to explicitly include
"tests" : [],
// Useful for excluding any tests that this tool will match
// e.g. you use .notification class for notification elements,
// but don’t want the test for Notification API
"excludeTests": [],
// By default, will crawl your project for references to Modernizr tests
// Set to false to disable
"crawl" : true,
// Set to true to pass in buffers via the "files" parameter below
"useBuffers" : false,
// By default, this task will crawl all *.js, *.css, *.scss files.
"files" : {
"src": [
"*[^(g|G)runt(file)?].{js,css,scss}",
"**[^node_modules]/**/*.{js,css,scss}",
"!lib/**/*"
]
},
// Have custom Modernizr tests? Add them here.
"customTests" : [],
// Add custom prefix to Modernizr CSS classes
"classPrefix" : ''
}
cache (Boolean, optional)
When true, customizr will avoid the expensive build process if a certain criteria is met (see Caching section below)
devFile (String, optional)
Path to the local build file you're using for development. This parameter is needed so customizr can skip your dev file when traversing your project to avoid triggering false positives. If you're using a remote file for development, set this option to remote.
This is an optional parameter. If you do not have a local devFile, set this option to false. Note that if this parameter is false and you have a local development file, it will find all Modernizr references from this file and will defeat the purpose of this tool.
dest (String, optional)
Path to save the customized Modernizr build. It defaults to lib/modernizr-custom.js.
This is an optional parameter. If undefined or falsy, customizr will return the result as a string and will not write to disk.
options (Array, optional)
An array of extra configuration options. Check the extra section on modernizr.com/download for complete options. Defaults are as they appear on the official site.
This is an optional parameter.
quiet (Boolean, optional)
By default, the build process is verbose. Set to true to build silently.
This is an optional parameter.
uglify (Boolean, optional)
By default, the source is uglified before save. Set to false to disable.
This is an optional parameter.
tests (Array, optional)
Define any tests you want to explicitly include. Check out the full set of test options here.
This is an optional parameter.
excludeTests (Array, optional)
Useful for excluding any tests that this tool will match. (e.g. you use .notification class for notification elements, but don’t want the test for Notification API).
This is an optional parameter.
crawl (Boolean, optional)
By default, this task will crawl your project for references to Modernizr tests. Set to false to disable.
This is an optional parameter.
useBuffers (Boolean, optional)
When true, the files parameter will accept an array of buffers in lieu of lookup strings.
files.src (Array, optional)
When crawl = true, this task will crawl all *.js, *.css, *.scss files. You can override this by defining a custom files.src array. The object supports either:
An array of all minimatch options
An array of Vinyl-style File buffers. useBuffers must be true to enable this functionality.
This is an optional parameter.
customTests (Array, optional)
Have custom Modernizr tests? Add paths to their location here. The object supports all minimatch options.
This is an optional parameter.
classPrefix (String, optional)
Add custom prefix to Modernizr classes to avoid clashes with your preexisting class names.
This is an optional parameter.
Caching
For large projects, building a custom Modernizr file can be an expensive task. customizr does its best to avoid unnecessary builds by following a set criteria. When all of the following are met, it assumes that no changes are necessary:
If customizr has been previously run AND
If settings.cache is true AND
If settings.dest exists and is identical to the previous build AND
If the customizr version is identical to the previous build AND
If the modernizr dependency is identical to the previous build AND
If the current customizr settings are identical to the previous build THEN
customizr returns the cached data found in settings.dest
If any of the preceding rules are falsy, the cache is invalidated.
If settings.cache is falsy, the cache is invalidated.
If settings.dest is not defined, the cache is invalidated.
Programmatic API
require("customizr")(settings, callback)
settings — A settings object as described above in "Config File".
callback — A callback to execute when the task is finished
You can use customizr directly in your app if you prefer to not rely on the binary.
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/Modernizr/customizr là nguồn chính thức.
Modernizr/customizr có bao nhiêu sao?
Modernizr/customizr có 64 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/Modernizr/customizr. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
Modernizr/customizr có phải mã nguồn mở không?
Có — Modernizr/customizr phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/Modernizr/customizr.
Modernizr/customizr có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho Modernizr/customizr. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
Modernizr/customizr có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho Modernizr/customizr. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
Modernizr/customizr còn đang phát triển không?
Commit gần nhất trên Modernizr/customizr là 7 ngày trước (theo timestamp GitHub). Repo có 39 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về customizr?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về customizr.