Skip to content

Commit

Permalink
@gkatsev updated css to have ascii codepoints for fonticons. Expose n…
Browse files Browse the repository at this point in the history
…ew scss file. closes #2973
  • Loading branch information
gkatsev committed Jan 8, 2016
1 parent 867fec9 commit 93f2f83
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CHANGELOG
* @forbesjo fixed errorDisplay erroring on subsequent openings ([view](https://github.com/videojs/video.js/pull/2966))
* @incompl updated build command in CONTRIBUTING.md ([view](https://github.com/videojs/video.js/pull/2967))
* @forbesjo updated player to not autoplay if there is no source ([view](https://github.com/videojs/video.js/pull/2971))
* @gkatsev updated css to have ascii codepoints for fonticons. Expose new scss file ([view](https://github.com/videojs/video.js/pull/2973))

--------------------

Expand Down
16 changes: 14 additions & 2 deletions build/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module.exports = function(grunt) {
watch: {
skin: {
files: ['src/css/**/*'],
tasks: 'sass'
tasks: ['sass', 'wrapcodepoints']
},
jshint: {
files: ['src/**/*', 'test/unit/**/*.js', 'Gruntfile.js'],
Expand Down Expand Up @@ -196,7 +196,7 @@ module.exports = function(grunt) {
sass: {
build: {
files: {
'build/temp/video-js.css': 'src/css/video-js.scss'
'build/temp/video-js.css': 'src/css/vjs.scss'
}
}
},
Expand Down Expand Up @@ -455,6 +455,7 @@ module.exports = function(grunt) {
'uglify',

'sass',
'wrapcodepoints',
'version:css',
'cssmin',

Expand All @@ -479,6 +480,17 @@ module.exports = function(grunt) {
'zip:dist'
]);

// Sass turns unicode codepoints into utf8 characters.
// We don't want that so we unwrapped them in the templates/scss.hbs file.
// After sass has generated our css file, we need to wrap the codepoints
// in quotes for it to work.
grunt.registerTask('wrapcodepoints', function() {
const sassConfig = grunt.config.get('sass.build.files');
const cssPath = Object.keys(sassConfig)[0];
const css = grunt.file.read(cssPath);
grunt.file.write(cssPath, css.replace(/(\\f\w+);/g, "'$1';"));
});

// Default task - build and test
grunt.registerTask('default', ['test']);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"object.assign": "^4.0.1",
"safe-json-parse": "^4.0.0",
"tsml": "1.0.1",
"videojs-font": "1.4.0",
"videojs-font": "1.5.1",
"videojs-ie8": "1.1.1",
"videojs-swf": "5.0.1",
"videojs-vtt.js": "^0.12.1",
Expand Down
1 change: 1 addition & 0 deletions src/css/_variables.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$icon-font-path: 'font' !default;
$icon-codepoints: false !default;
6 changes: 5 additions & 1 deletion src/css/video-js.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
@import "private-variables";
@import "utilities";

@import "../../node_modules/videojs-font/scss/icons";
@if $icon-codepoints {
@import "../../node_modules/videojs-font/scss/icons-codepoints";
} else {
@import "../../node_modules/videojs-font/scss/icons";
}

@import "components/layout";
@import "components/big-play";
Expand Down
3 changes: 3 additions & 0 deletions src/css/vjs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$icon-codepoints: true;

@import "video-js";

0 comments on commit 93f2f83

Please sign in to comment.