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

@import of bootstrap with ember-cli-less fails #133

Closed
huafu opened this issue Sep 12, 2016 · 13 comments
Closed

@import of bootstrap with ember-cli-less fails #133

huafu opened this issue Sep 12, 2016 · 13 comments

Comments

@huafu
Copy link

huafu commented Sep 12, 2016

I've just setup a new ember project, added ember-cli-less, ember-font-awesome and this addon. The font-awesome import does work, but importing the bootstrap-less/bootstrap does not.
I've looked into your code and debugged ember serve, sounds like the detection of ember-cli-less is ok and includes bower_components/bootstrap/less in the trees.
Now I am out of ideas where to look and that has been too long I did not write anything ember-addon related... can't figure out why the less thing isn't working.

Here is what I did (I yet did not created/changed any other file):

$ ember new bnh-router
$ ember install ember-cli-less
$ ember install ember-moment
$ ember install ember-font-awesome
$ ember install ember-bootstrap

I remove app/styles/app.css and created app/styles/app.less as so:

// app.less
@import "ember-bootstrap/bootstrap";
@import "ember-bootstrap/theme";

@import "font-awesome";

Here is the error I got:

$ ember serve

Just getting started with Ember? Please visit http://localhost:4200/ember-getting-started to get going

Livereload server on http://localhost:49152
Serving on http://localhost:4200/
FileError: 'ember-bootstrap/bootstrap.less' wasn't found. Tried - /home/huafu/Projects/bnh-router/tmp/less_compiler-input_base_path-XvM8YpAS.tmp/0/app/styles/ember-bootstrap/bootstrap.less,/home/huafu/Projects/bnh-router/tmp/less_compiler-input_base_path-XvM8YpAS.tmp/0/app/styles/ember-bootstrap/bootstrap.less,bower_components/font-awesome/less/ember-bootstrap/bootstrap.less,ember-bootstrap/bootstrap.less in /home/huafu/Projects/bnh-router/tmp/less_compiler-input_base_path-XvM8YpAS.tmp/0//app/styles/app.less on line 2, column 1:
1 // app.less
2 @import "ember-bootstrap/bootstrap";
3 @import "ember-bootstrap/theme";

File: /home/huafu/Projects/bnh-router/tmp/less_compiler-input_base_path-XvM8YpAS.tmp/0//app/styles/app.less (2)
The Broccoli Plugin: [LessCompiler] failed with:
undefined

The broccoli plugin was instantiated at: 
    at LessCompiler.Plugin (/home/huafu/Projects/bnh-router/node_modules/ember-cli-less/node_modules/broccoli-less-single/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
    at LessCompiler.CachingWriter [as constructor] (/home/huafu/Projects/bnh-router/node_modules/ember-cli-less/node_modules/broccoli-less-single/node_modules/broccoli-caching-writer/index.js:18:10)
    at new LessCompiler (/home/huafu/Projects/bnh-router/node_modules/ember-cli-less/node_modules/broccoli-less-single/index.js:15:17)
    at /home/huafu/Projects/bnh-router/node_modules/ember-cli-less/index.js:28:12
    at Array.map (native)
    at LESSPlugin.toTree (/home/huafu/Projects/bnh-router/node_modules/ember-cli-less/index.js:24:34)
    at /home/huafu/Projects/bnh-router/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:184:26
    at Array.forEach (native)
    at processPlugins (/home/huafu/Projects/bnh-router/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:182:11)
    at module.exports.preprocessCss (/home/huafu/Projects/bnh-router/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:152:10)

My package.json devDependencies:

{
    "broccoli-asset-rev": "^2.4.2",
    "ember-ajax": "^2.0.1",
    "ember-bootstrap": "0.9.1",
    "ember-cli": "2.8.0",
    "ember-cli-app-version": "^1.0.0",
    "ember-cli-babel": "^5.1.6",
    "ember-cli-dependency-checker": "^1.2.0",
    "ember-cli-htmlbars": "^1.0.3",
    "ember-cli-htmlbars-inline-precompile": "^0.3.1",
    "ember-cli-inject-live-reload": "^1.4.0",
    "ember-cli-jshint": "^1.0.0",
    "ember-cli-less": "1.5.3",
    "ember-cli-moment-shim": "2.0.0",
    "ember-cli-qunit": "^2.1.0",
    "ember-cli-release": "^0.2.9",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-test-loader": "^1.1.0",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "^2.8.0",
    "ember-export-application-global": "^1.0.5",
    "ember-font-awesome": "2.2.0",
    "ember-load-initializers": "^0.5.1",
    "ember-moment": "7.0.0-beta.3",
    "ember-resolver": "^2.0.3",
    "ember-welcome-page": "^1.0.1",
    "loader.js": "^4.0.1"
}

My bower.json dependencies:

{
    "ember": "~2.8.0",
    "ember-cli-shims": "0.1.1",
    "bootstrap": "~3.3.5",
    "font-awesome": "~4.5.0"
}

Versions

$ node -v
v6.2.2

$ npm -v
3.10.7

$ ember -v
ember-cli: 2.8.0
node: 6.2.2
os: linux x64
@huafu huafu changed the title @import of bootstrap with ember-cli-less fail @import of bootstrap with ember-cli-less fails Sep 12, 2016
@simonihmig
Copy link
Contributor

Looks good to me, no idea why that fails... do you have this available on a public repo?

@simonihmig
Copy link
Contributor

Just had a fresh new app setup this way without problems. As there is missing feedback and no way to reproduce, I will close this for now.

@maxkoryukov
Copy link

A little bit more info.

It is enough to edit ember-cli-build.js , by adding paths for less:

module.exports = function(defaults) {
	const app = new EmberApp(defaults, {
		'lessOptions': {
			paths: [
				'.',
				'node_modules',
			]
		},
// ....
}

And the error will appear. If you will delete paths option - the error will dissappear;)

@maxkoryukov
Copy link

Ping @simonihmig to open/reconsider the bug, if it is possible ;)

I tried to understand, what is going on, but seems like I need to understand how Ember build works in details

@maxkoryukov
Copy link

maxkoryukov commented Mar 28, 2017

Another one finding: any other plugin could break the build.

I just added ember-font-awesome and tried to enable less import for that package:

module.exports = function(defaults) {
	const app = new EmberApp(defaults, {
		'ember-font-awesome': {
			useLess: true,
		},

And got the same error:

FileError: 'ember-bootstrap/bootstrap.less' wasn't found.
Tried - 
/home/x/my-project/tmp/less_compiler-input_base_path-v60VzZJ6.tmp/0/app/styles/ember-bootstrap/bootstrap.less,
/home/x/my-project/tmp/less_compiler-input_base_path-v60VzZJ6.tmp/0/app/styles/ember-bootstrap/bootstrap.less,
/home/x/my-project/node_modules/font-awesome/less/ember-bootstrap/bootstrap.less,
ember-bootstrap/bootstrap.less
in /home/x/my-project/tmp/less_compiler-input_base_path-v60VzZJ6.tmp/0//app/styles/app.less on line 26, column 1:
25 
26 @import "ember-bootstrap/bootstrap";
27 //@import "font-awesome";

As you could see - @import "font-awesome" is commented! The error caused by importing the bootstrap asset..

@simonihmig
Copy link
Contributor

Will have a look. Looks as if something changes with the paths that Less uses to look for files to import, so it won't find bootstrap...

@maxkoryukov
Copy link

maxkoryukov commented Mar 28, 2017

I could try to fix, but I need an entry points (articles, post, guides...) for

  • ember build workflow
  • broccolli

If you have a good starter pack I will appreciate!

@simonihmig
Copy link
Contributor

I investigated this a bit. It seems to me this is a bug in one of the upstream Less packages, see the PR above, that needs to be fixed there. Not much I can do in this addon for now, I think...

@simonihmig
Copy link
Contributor

ember-cli-less 1.5.4 just got released, and should fix this!

@maxkoryukov can you confirm?

@maxkoryukov
Copy link

@simonihmig let me check;)

@maxkoryukov
Copy link

@simonihmig great, my build fixed! Thank you!

@simonihmig
Copy link
Contributor

Cool, thanks for checking!

@maxkoryukov
Copy link

@simonihmig thank you! You are the real power of open-source culture;)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants