-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update/site-settings-jetpack
- Loading branch information
Showing
156 changed files
with
2,639 additions
and
964 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
|
||
var fs = require( 'fs' ); | ||
var validIconSizes = [ 12, 18, 24, 36, 48, 54, 72 ]; | ||
|
||
var filename = process.argv[ 2 ]; | ||
|
||
fs.readFile( filename, 'utf8', function ( err, data ) { | ||
var result = '', | ||
splittedCode, | ||
lineNumber = 1; | ||
if ( err ) { | ||
console.log(err); | ||
process.exit( 1 ); | ||
} | ||
data = data.toLowerCase(); | ||
splittedCode = data.split( '<gridicon' ); | ||
|
||
if ( splittedCode.length > 1 ) { | ||
// There are gridicon instances in this file. | ||
splittedCode.forEach( function( chunk ) { | ||
var gridiconAttrs, isNonStandard, size; | ||
if( chunk ) { | ||
// we discard all the code after the tag closing... we are only interested in the props of the gridicon. | ||
gridiconAttrs = chunk.split( '>' )[ 0 ]; | ||
isNonStandard = gridiconAttrs.indexOf( 'nonstandardsize' ) >= 0; | ||
if ( gridiconAttrs.indexOf( 'size={' ) >= 0 ) { | ||
size = gridiconAttrs.split( 'size={' )[ 1 ].split( '}' )[ 0 ]; | ||
if ( !isNaN( size ) ) { | ||
// We only can check if the size is standard if it is a number. If not (variables), we have no way of knowing if it's fine or not | ||
if( !isNonStandard && validIconSizes.indexOf( +size ) < 0 ) { | ||
result += '\033[31mNon-standard gridicon size ( ' + size + 'px ) detected in ' + filename + ' line ' + lineNumber + '\n'; | ||
} | ||
if( isNonStandard && validIconSizes.indexOf( +size ) >= 0 ) { | ||
result += '\033[33mStandard size gridicon ( ' + size + 'px ) marked as non-standard... are you sure that is ok? in ' + filename + ' line ' + lineNumber + '\n'; | ||
} | ||
} | ||
} | ||
lineNumber += chunk.split('\n').length - 1; | ||
} | ||
} ); | ||
} | ||
|
||
if ( result !== '' ) { | ||
console.error( result ); | ||
console.log( '\033[mValid gridiconsizes are ' + validIconSizes.join( 'px, ' ) + 'px' ); | ||
console.log( '\033[mIf you need any of those Gridicons to have a non-standard size, please, add \'nonStandardSize\' as a property. See https://github.com/Automattic/wp-calypso/tree/master/shared/components/gridicon#props \n' ); | ||
process.exit( 1 ); | ||
} else { | ||
process.exit( 0 ); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.