https://github.com/alephao/lalainc-xcassetscop
Enforce configurations on Xcode assets
https://github.com/alephao/lalainc-xcassetscop
linter xcode
Last synced: 4 months ago
JSON representation
Enforce configurations on Xcode assets
- Host: GitHub
- URL: https://github.com/alephao/lalainc-xcassetscop
- Owner: alephao
- License: mit
- Created: 2019-05-04T14:28:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-14T12:48:18.000Z (about 7 years ago)
- Last Synced: 2025-10-26T19:43:17.520Z (8 months ago)
- Topics: linter, xcode
- Language: Ruby
- Homepage:
- Size: 39.1 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XCAssetsCop
[](https://travis-ci.org/alaphao/xcassetscop)
[](https://badge.fury.io/rb/xcassetscop)
XCAssetsCop is a tool to enforce specific configurations of Xcode assets.
For example, you can ensure every asset inside `Image.xcassets/icons` is rendered as template, has a single scale, and is a pdf file.
### Installing
```
gem install xcassetscop
```
or add this to your Gemfile
```
gem 'xcassetscop'
```
### Getting Started
Create a xcassetsconfig.yml, it should contain a list of objects with two properties:
- **config**: An object with your configs, check the available options on the next section
- **paths**: List of paths to apply the configs
```yaml
---
- paths:
- "./MyApp/Images.xcassets/icons/**/*.imageset/Contents.json"
- "./MyApp/Images.xcassets/some_folder/**/*.imageset/Contents.json"
config:
template_rendering_intent: template
image_scale: single
same_file_and_asset_name: true
file_extension: pdf
- paths:
- "./MyApp/Images.xcassets/illustrations/**/*.imageset/Contents.json"
config:
template_rendering_intent: original
image_scale: individual
```
Then run
```
xcassetscop lint
```
### Available Options for Config
| Key | Description |
| --- | --- |
| template_rendering_intent | Ensures the assets have a specific template_rendering_intent value. Valid values are: **template**, **original**, **default** |
| image_scale | Ensures the asset have a specific image scale value. Valid values are: **single**, **individual**, **individual_and_single** |
| preserves-vector-representation | Ensures the assets preserves or not the vector information of a PDF file |
| same_file_and_asset_name | true if you want to make sure the asset name and the file name are the same |
| file_extension | A **string** or **symbol** of the file extension. Ensures the file has a specific extenstion. E.g: `'pdf'` |
### License
MIT