Skip to content

Commit ed63819

Browse files
Merge pull request #16 from dreamsiclemedia/develop
es6 all the things. Updates to 0.0.5 @ npm.
2 parents 017884b + 5c4a163 commit ed63819

File tree

6 files changed

+17
-18
lines changed

6 files changed

+17
-18
lines changed

dist/js/speckle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/dist/js/main.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const sass = require('gulp-sass');
1515
const sassLint = require('gulp-sass-lint');
1616
const autoprefixer = require('gulp-autoprefixer');
1717

18-
1918
/**
2019
* Clean module build directory.
2120
*
@@ -129,7 +128,7 @@ gulp.task('lint', gulp.series('lint:js', 'lint:sass'));
129128
* - Global command: `gulp build:js:docs`.
130129
* - Local command: `node ./node_modules/gulp/bin/gulp build:js:docs`.
131130
*/
132-
gulp.task('build:js:docs', gulp.series('lint:js', function jsDocsBuilder() {
131+
gulp.task('build:js:docs', function jsDocsBuilder() {
133132
const bundler = browserify('docs/assets/src/js/main.js', { debug: true }).transform(babel, { presets: ['env'] });
134133
return bundler.bundle()
135134
.on('error', function(err) { console.error(err); this.emit('end'); })
@@ -141,7 +140,7 @@ gulp.task('build:js:docs', gulp.series('lint:js', function jsDocsBuilder() {
141140
.pipe(sourcemaps.write('.'))
142141
.pipe(gulp.dest('docs/assets/dist/js'))
143142
.pipe(debug({ title: 'build:js:docs' }));
144-
}));
143+
});
145144

146145
/**
147146
* Build Module JS.
@@ -160,7 +159,7 @@ gulp.task('build:js:docs', gulp.series('lint:js', function jsDocsBuilder() {
160159
* - Global command: `gulp build:js:module`.
161160
* - Local command: `node ./node_modules/gulp/bin/gulp build:js:module`.
162161
*/
163-
gulp.task('build:js:module', gulp.series('lint:js', function jsModuleBuilder() {
162+
gulp.task('build:js:module', function jsModuleBuilder() {
164163
const bundler = browserify('src/js/speckle.js', { debug: true }).transform(babel, { presets: ['env'] });
165164
return bundler.bundle()
166165
.on('error', function(err) { console.error(err); this.emit('end'); })
@@ -170,7 +169,7 @@ gulp.task('build:js:module', gulp.series('lint:js', function jsModuleBuilder() {
170169
.pipe(sourcemaps.write('.'))
171170
.pipe(gulp.dest('dist/js'))
172171
.pipe(debug({ title: 'build:js:module' }));
173-
}));
172+
});
174173

175174
/**
176175
* Build all JS.
@@ -183,7 +182,7 @@ gulp.task('build:js:module', gulp.series('lint:js', function jsModuleBuilder() {
183182
* - Global command: `gulp build:js`.
184183
* - Local command: `node ./node_modules/gulp/bin/gulp build:js`.
185184
*/
186-
gulp.task('build:js', gulp.series('build:js:module', 'build:js:docs'));
185+
gulp.task('build:js', gulp.series('lint:js', 'build:js:module', 'build:js:docs'));
187186

188187
/**
189188
* Build Sass.
@@ -246,7 +245,7 @@ gulp.task('watch', function watcher() {
246245
// Lint js when gulpfile.js changes, but do not build.
247246
gulp.watch('gulpfile.js', gulp.series('lint:js'));
248247
// Watch speckle.js file, and docs src js. Rebuild JS on change.
249-
gulp.watch(['src/speckle.js', 'docs/assets/src/**/*.js'], gulp.series('build:js'));
248+
gulp.watch(['src/**/*.js', 'docs/assets/src/**/*.js'], gulp.series('build:js'));
250249
// Watch all docs src sass. Rebuild Sass on change.
251250
gulp.watch(['docs/assets/src/**/*.scss'], gulp.series('build:sass'));
252251
});

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "speckle-js",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "A JavaScript module that adds responsive, stylized speckles to any element; with no dependencies.",
55
"main": "src/js/speckle.js",
66
"scripts": {

src/js/speckle.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class Speckle {
145145
message = 'The value must be between 1 and 100, and greater than `minOpacity`.';
146146
}
147147
throw new Error(
148-
'Speckle.js [' + key + ']\n' + message
148+
`Speckle.js [${key}]\n` + message
149149
);
150150
}
151151

@@ -168,7 +168,7 @@ class Speckle {
168168
* @return {string} A random hex color.
169169
*/
170170
getRandomHex() {
171-
return '#' + ('000000' + Math.random().toString(16).slice(2, 8)).slice(-6).toUpperCase();
171+
return `#${('000000' + Math.random().toString(16).slice(2, 8)).slice(-6).toUpperCase()}`;
172172
}
173173

174174
getStyles(element) {
@@ -181,12 +181,12 @@ class Speckle {
181181
// Create the styles object.
182182
return Object.assign(this.globalStyles, {
183183
backgroundColor: renderColor,
184-
boxShadow: isBokeh ? ('0 0 ' + (size / 3) + 'px ' + (size / 3) + 'px ' + renderColor) : '',
185-
height: size + 'px',
186-
left: 'calc(' + this.getRandomInt(0 - lrOffset, 100 + lrOffset) + '% - ' + center + 'px)',
184+
boxShadow: isBokeh ? `0 0 ${(size / 3)}px ${(size / 3)}px ${renderColor}` : '',
185+
height: `${size}px`,
186+
left: `calc(${this.getRandomInt(0 - lrOffset, 100 + lrOffset)}% - ${center}px)`,
187187
opacity: (this.getRandomInt(minOpacity, maxOpacity) * 0.01),
188-
top: 'calc(' + this.getRandomInt(0 - tbOffset, 100 + tbOffset) + '% - ' + center + 'px)',
189-
width: size + 'px',
188+
top: `calc(${this.getRandomInt(0 - tbOffset, 100 + tbOffset)}% - ${center}px)`,
189+
width: `${size}px`,
190190
zIndex: zIndex,
191191
});
192192
}

0 commit comments

Comments
 (0)