Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support colocated components #343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let VersionChecker = require("ember-cli-version-checker");
module.exports = {

_getStyleFunnel: function() {
return new Merge([this._getPodStyleFunnel(), this._getClassicStyleFunnel()], {
return new Merge([this._getPodStyleFunnel(), this._getClassicStyleFunnel(),this._getColocatedComponentsStyleFunnel()], {
annotation: 'Merge (ember-component-css merge pod and classic styles)'
});
},
Expand All @@ -34,6 +34,15 @@ module.exports = {
});
},

_getColocatedComponentsStyleFunnel: function() {
return new Funnel(this.projectRoot, {
srcDir: 'components',
include: ['**/*.{' + this.allowedStyleExtensions + ',}'],
allowEmpty: true,
annotation: 'Funnel (ember-component-css grab colocated components files)'
});
},

_podDirectory: function() {
return this.appConfig.podModulePrefix && !this._isAddon() ? this.appConfig.podModulePrefix.replace(this.appConfig.modulePrefix, '') : '';
},
Expand Down
8 changes: 7 additions & 1 deletion lib/component-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var md5 = require('md5');
var path = require('path');

module.exports = {
path: function(actualPath, classicStyleDir) {
Expand All @@ -11,7 +12,12 @@ module.exports = {
if (actualPath.includes(classicStyleDir)) {
terminator = '.';
pathSegementToRemove = 'styles/' + classicStyleDir + '/';
}
} else { // Colocated component stylesheet
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is where the failing tests aren't passing. If there was a way to only have this branch be exercised if it's colocated styles, that would be beneficial.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failing tests are due to other octane changes on my second viewing now.

var pathInfo = path.parse(actualPath);
if (pathInfo.name !== 'styles') {
terminator = '.';
}
}

return actualPath.substr(0, actualPath.lastIndexOf(terminator)).replace(pathSegementToRemove, '');
},
Expand Down