From abcf2f1cdbacec67e6df87f2b04c7fad9c90ad18 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 19 Jan 2018 17:06:31 +0900 Subject: [PATCH 1/2] Add priority to stylesheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that themes and user’s styles.less come after. --- lib/models/style-calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/models/style-calculator.js b/lib/models/style-calculator.js index 434500e408..9c72022ed0 100644 --- a/lib/models/style-calculator.js +++ b/lib/models/style-calculator.js @@ -25,6 +25,6 @@ export default class StyleCalculator { @autobind updateStyles(sourcePath, getStylesheetFn) { const stylesheet = getStylesheetFn(this.config); - this.styles.addStyleSheet(stylesheet, {sourcePath}); + this.styles.addStyleSheet(stylesheet, {sourcePath, priority: 0}); } } From bbba3f2466382ad7e06c65b4bb7b225e80a384ba Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 19 Jan 2018 00:43:31 -0800 Subject: [PATCH 2/2] Update test to have priority --- test/models/style-calculator.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/models/style-calculator.test.js b/test/models/style-calculator.test.js index 02a3760187..c88adeb224 100644 --- a/test/models/style-calculator.test.js +++ b/test/models/style-calculator.test.js @@ -44,19 +44,19 @@ describe('StyleCalculator', function(done) { assert.deepEqual(Object.keys(configChangeCallbacks), ['config1', 'config2']); assert.equal(stylesMock.addStyleSheet.callCount, 1); assert.deepEqual(stylesMock.addStyleSheet.getCall(0).args, [ - expectedCss, {sourcePath: 'my-source-path'}, + expectedCss, {sourcePath: 'my-source-path', priority: 0}, ]); configChangeCallbacks.config1(); assert.equal(stylesMock.addStyleSheet.callCount, 2); assert.deepEqual(stylesMock.addStyleSheet.getCall(1).args, [ - expectedCss, {sourcePath: 'my-source-path'}, + expectedCss, {sourcePath: 'my-source-path', priority: 0}, ]); configChangeCallbacks.config2(); assert.equal(stylesMock.addStyleSheet.callCount, 3); assert.deepEqual(stylesMock.addStyleSheet.getCall(2).args, [ - expectedCss, {sourcePath: 'my-source-path'}, + expectedCss, {sourcePath: 'my-source-path', priority: 0}, ]); }); });