-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a config to skip minification
- Loading branch information
1 parent
8f3d22a
commit 0e459ea
Showing
13 changed files
with
2,172 additions
and
843 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,30 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
let objectHash = require('object-hash'); | ||
|
||
module.exports = { | ||
name: 'ember-hbs-minifier', | ||
|
||
setupPreprocessorRegistry(type, registry) { | ||
if (type === 'parent') { | ||
let HbsMinifierPlugin = require('./hbs-minifier-plugin'); | ||
_setupPreprocessorRegistry(app) { | ||
let registry = app.registry; | ||
let options = app.options || {}; | ||
let config = options['ember-hbs-minifier'] || {}; | ||
|
||
registry.add('htmlbars-ast-plugin', { | ||
name: 'hbs-minifier-plugin', | ||
plugin: HbsMinifierPlugin, | ||
baseDir() { return __dirname; } | ||
}); | ||
} | ||
let HbsMinifierPlugin = require('./hbs-minifier-plugin')(config.skip || {}); | ||
registry.add('htmlbars-ast-plugin', { | ||
name: 'hbs-minifier-plugin', | ||
plugin: HbsMinifierPlugin, | ||
baseDir() { return __dirname; }, | ||
cacheKey() { return `ember-hbs-minifier-${objectHash.MD5(config)}`; } | ||
}); | ||
}, | ||
|
||
included(app) { | ||
this._super.included.apply(this, arguments); | ||
/* | ||
Calling setupPreprocessorRegistry in included hook since app.options is not accessible | ||
Refer PR: https://github.com/ember-cli/ember-cli/pull/7059 | ||
*/ | ||
this._setupPreprocessorRegistry(app); | ||
} | ||
}; |
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,6 @@ | ||
import Ember from 'ember'; | ||
import layout from '../templates/components/foo-bar'; | ||
|
||
export default Ember.Component.extend({ | ||
layout | ||
}); |
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,6 @@ | ||
import Ember from 'ember'; | ||
import layout from '../templates/components/x-button'; | ||
|
||
export default Ember.Component.extend({ | ||
layout | ||
}); |
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,8 @@ | ||
1 | ||
<span> | ||
2 | ||
</span> | ||
<span> | ||
3 | ||
</span> | ||
{{yield}} |
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,2 @@ | ||
save | ||
{{yield}} |
Oops, something went wrong.