Skip to content

Commit

Permalink
Update warning message for missing sprite field
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhamley committed Nov 2, 2018
1 parent 046f1a8 commit 1a45039
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/style-spec/validate/validate_property.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function validateProperty(options, propertyType) {
const propertyKey = options.objectKey;
const layerSpec = styleSpec[`${propertyType}_${options.layerType}`];
const propsThatRequireSprite = ['background-pattern', 'fill-pattern', 'fill-extrusion-pattern', 'line-pattern', 'icon-image'];

if (!layerSpec) return [];

const transitionMatch = propertyKey.match(/^(.*)-transition$/);
Expand Down Expand Up @@ -55,7 +54,7 @@ export default function validateProperty(options, propertyType) {

if (options.layerType === 'background' || options.layerType === 'fill' || options.layerType === 'fill-extrusion' || options.layerType === 'line' || options.layerType === 'symbol') {
if (propsThatRequireSprite.indexOf(propertyKey) > -1 && style && !style.sprite) {
warnOnce(`Use of "${propertyKey}" in may require a style "sprite" property. If you're experiencing a problem, please ensure that your image has loaded correctly.`);
warnOnce(`Use of "${propertyKey}" in style "${style.name}" may require a style "sprite" property. If you're experiencing a problem, please ensure that your image has loaded correctly.`);
}
}

Expand Down

0 comments on commit 1a45039

Please sign in to comment.