forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove libsass as a dependency (elastic#9803)
Remove libsass as a dependency libsass is platform specific, therefore we can not ship it as a dependency. Instead, we will commit the compiled CSS for the UI Framework to the repository. This is updated when running `npm run uiFramework:start` which also starts the docs site. Signed-off-by: Tyler Smalley <[email protected]>
- Loading branch information
1 parent
76b886d
commit 3b0722c
Showing
133 changed files
with
1,098 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ selenium | |
*.swp | ||
*.swo | ||
*.out | ||
src/ui_framework/doc_site/build/*.js* | ||
ui_framework/doc_site/build/*.js* |
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,76 @@ | ||
const sass = require('node-sass'); | ||
const postcss = require('postcss'); | ||
const postcssConfig = require('../src/optimize/postcss.config'); | ||
const chokidar = require('chokidar'); | ||
const debounce = require('lodash/function/debounce'); | ||
const platform = require('os').platform(); | ||
|
||
module.exports = function (grunt) { | ||
grunt.registerTask('uiFramework:start', function () { | ||
const done = this.async(); | ||
Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done); | ||
}); | ||
|
||
function uiFrameworkServerStart() { | ||
const serverCmd = { | ||
cmd: /^win/.test(platform) ? '.\\node_modules\\.bin\\webpack-dev-server' : './node_modules/.bin/webpack-dev-server', | ||
args: [ | ||
'--config=ui_framework/doc_site/webpack.config.js', | ||
'--hot ', | ||
'--inline', | ||
'--content-base=ui_framework/doc_site/build' | ||
], | ||
opts: { stdio: 'inherit' } | ||
}; | ||
|
||
return new Promise((resolve, reject) => { | ||
grunt.util.spawn(serverCmd, (error, result, code) => { | ||
if (error || code !== 0) { | ||
const message = result.stderr || result.stdout; | ||
|
||
grunt.log.error(message); | ||
|
||
return reject(); | ||
} | ||
|
||
grunt.log.writeln(result); | ||
|
||
resolve(); | ||
}); | ||
|
||
}); | ||
} | ||
|
||
function uiFrameworkCompile() { | ||
sass.render({ | ||
file: 'ui_framework/components/index.scss' | ||
}, function (error, result) { | ||
if (error) { | ||
grunt.log.error(error); | ||
} | ||
|
||
postcss([postcssConfig]) | ||
.process(result.css, { from: 'ui_framework/components/index.scss', to: 'ui_framework/dist/ui_framework.css' }) | ||
.then(result => { | ||
grunt.file.write('ui_framework/dist/ui_framework.css', result.css); | ||
|
||
if (result.map) { | ||
grunt.file.write('ui_framework/dist/ui_framework.css.map', result.map); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
function uiFrameworkWatch() { | ||
const debouncedCompile = debounce(uiFrameworkCompile, 400, { leading: true }); | ||
|
||
return new Promise((resolve, reject) => { | ||
debouncedCompile(); | ||
|
||
chokidar.watch('ui_framework/components', { ignoreInitial: true }).on('all', (event, path) => { | ||
grunt.log.writeln(event, path); | ||
debouncedCompile(); | ||
}); | ||
}); | ||
} | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.