Gathering detailed insights and metrics for grunt-iconpack
Gathering detailed insights and metrics for grunt-iconpack
Gathering detailed insights and metrics for grunt-iconpack
Gathering detailed insights and metrics for grunt-iconpack
Package SVG icons as an SVG sprite. Support for webfonts is planned.
npm install grunt-iconpack
Typescript
Module System
Min. Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
21 Commits
2 Forks
1 Branches
2 Contributors
Updated on Mar 13, 2015
Latest Version
0.0.2
Package Id
grunt-iconpack@0.0.2
Size
6.58 kB
NPM Version
1.4.28
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
4
Package SVG icons as an SVG sprite. Support for webfonts is planned.
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
1npm install grunt-iconpack --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
1grunt.loadNpmTasks('grunt-iconpack');
In your project's Gruntfile, add a section named iconpack
to the data object passed into grunt.initConfig()
.
1grunt.initConfig({
2 iconpack: {
3 options: {
4 // Task-specific options go here.
5 },
6 your_target: {
7 // Target-specific options and configuration go here.
8 },
9 },
10});
Type: Array
Default value: false
An array of directory paths in which to search for source files. For each src
path defined in the normal Grunt files config, load paths are searched (in array order) for matching files. Once a match is found, successive load paths for that src
are skipped.
This makes it easy to combine icon sets without having to write out the paths for each icon individually. The src
property can hold an array of filenames, and the loadPaths
option will load preferentially from the first path, then the second, and so on.
When using this option, the src
files can contain any normal Grunt globbing patterns which will be expanded under each load path, loadPaths
values can themselves contain glob patterns.
Type: String
Default value: ''
Add a prefix to the beginning of <symbol>
ids. Useful as a namespace to
avoid id attribute collisions. Example value: 'icon-'
.
Type: Boolean
Default value: true
By default, SVG <title>
elements are removed. Change this option to false
to keep them.
In addition to the loadPaths
option, this module allows you to leave off extensions in src
file paths. If absent, .svg
will automatically be appended.
In this example, the normal Grunt files array is used to build an SVG sprite from a single set of source SVGs.
1grunt.initConfig({
2 iconpack: {
3 basic_example: {
4 files: [{
5 expand: true,
6 cwd: 'assets/icons/src',
7 src: [
8 'menu.svg',
9 'search.svg',
10 'chevron-*.svg',
11 ],
12 dest: 'assets/icons/sprite.svg'
13 }]
14 }
15 },
16});
In this example, two sets of SVGs from different sources (here, a Bower component and some local files) are combined into one sprite.
The loadPaths
option allows conditional loading of icons from several sets. In this example, if menu.svg
is present in both load paths, the one found first (in this case, in assets/icons/src
) will be used instead of any menu.svg
provided by the Bower component.
Note that file extensions can be left off for source files; they will be appended automatically if absent.
1grunt.initConfig({
2 iconpack: {
3 using_load_paths: {
4 options: {
5 loadPaths: [
6 'assets/icons/src/**',
7 'bower_components/some-icon-set/svg/**'
8 ]
9 },
10 files: [{
11 src: [
12 'menu',
13 'search',
14 'chevron-*',
15 ],
16 dest: 'assets/icons/sprite.svg'
17 }]
18 }
19 },
20});
The following example doesn’t demonstrate any unique functionality but it does show what is made possible by features such as the loadPaths
option.
1grunt.initConfig({
2 iconpack: {
3 build_svg_sprite: {
4 options: {
5 loadPaths: [
6 'assets/icons/src/**',
7 'bower_components/some-icon-set/svg/**'
8 ]
9 },
10 files: [{
11 src: grunt.file.readJSON('assets/icons.json'),
12 dest: 'assets/icons/sprite.svg'
13 }]
14 }
15 },
16});
icons.json
might look like this:
1[ 2 "menu", 3 "search", 4 "chevron-*" 5]
This makes it easy to change which icons will be built into a sprite once loadPaths
are defined.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt: just run the following command in the project root:
1grunt
(Nothing yet)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/20 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More