linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

files.js adding bootstrap.css will cause bootstrap.less to be compiled #300

Closed tonyeung closed 9 years ago

tonyeung commented 9 years ago

I'm using the latest angular template

relevant line in files.js

        css: {
            vendor: [
              //"bower_components/bootstrap/dist/css/bootstrap.css",
              "vendor/css/**/*.css"
            ],
            app: [
              "app/css/**/*.css"
            ]
        },

uncomment that vendor line for bootstrap and all of sudden:

Running "concat_sourcemap:css" (concat_sourcemap) task
Warning: Unable to read "bower_components\bootstrap\dist\css\less\normalize.less
" file (Error code: ENOENT). Use --force to continue.

pulling the bootstrap.css file into the vendor file resulted in the same error, which is strange. further investigation shows that a minified version as well as a sourcemap file was copied with the original bootstrap.css file. removing the minified and sourcemap file yields a sourcemap missing error removing the offending line in the bootstrap.css file

/*# sourceMappingURL=bootstrap.css.map */

resolved the issue.

I guess the question is, is this supposed to happen? Will I have to copy out the bootstrap.css file every time bootstrap gets updated?

searls commented 9 years ago

Concat sourcemap is really noisy when a sourcemap (or a thing referenced by a sourcemap) is missing. Your options, it seems to me:

On Mon, Jul 28, 2014 at 2:56 AM, tonyeung notifications@github.com wrote:

I'm using the latest angular template relevant line in files.js

        css: {
            vendor: [
              //"bower_components/bootstrap/dist/css/bootstrap.css",
              "vendor/css/**/*.css"
            ],
            app: [
              "app/css/**/*.css"
            ]
        },

uncomment that vendor line for bootstrap and all of sudden:

Running "concat_sourcemap:css" (concat_sourcemap) task
Warning: Unable to read "bower_components\bootstrap\dist\css\less\normalize.less
" file (Error code: ENOENT). Use --force to continue.

pulling the bootstrap.css file into the vendor file resulted in the same error, which is strange. further investigation shows that a minified version as well as a sourcemap file was copied with the original bootstrap.css file. removing the minified and sourcemap file yields a sourcemap missing error removing the offending line in the bootstrap.css file

/*# sourceMappingURL=bootstrap.css.map */

resolved the issue.

I guess the question is, is this supposed to happen? Will I have to copy out the bootstrap.css file every time bootstrap gets updated?

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/300

tonyeung commented 9 years ago

Do you have any idea why the concat_sourcemap would cause it to try to compile the less files though?

Running "concat_sourcemap:css" (concat_sourcemap) task
Warning: Unable to read "bower_components\bootstrap\dist\css\less\normalize.less
" file (Error code: ENOENT). Use --force to continue.

all I'm trying to do is include the bootstrap.css file

searls commented 9 years ago

Yes, I imagine the bootstrap.css.map file references that less file (since bootstrap CSS is compiled from Less). If the Less file cannot be found relative to the root map, the task will apparently blow up.

On Mon, Jul 28, 2014 at 10:55 AM, tonyeung notifications@github.com wrote:

Do you have any idea why the concat_sourcemap would cause it to try to compile the less files though?

Running "concat_sourcemap:css" (concat_sourcemap) task
Warning: Unable to read "bower_components\bootstrap\dist\css\less\normalize.less
" file (Error code: ENOENT). Use --force to continue.

all I'm trying to do is include the bootstrap.css file

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/300#issuecomment-50349281

searls commented 9 years ago

I just noticed that it fails on a warning -- is it possible running lineman build --force will work as a stop gap?

On Mon, Jul 28, 2014 at 10:55 AM, tonyeung notifications@github.com wrote:

Do you have any idea why the concat_sourcemap would cause it to try to compile the less files though?

Running "concat_sourcemap:css" (concat_sourcemap) task
Warning: Unable to read "bower_components\bootstrap\dist\css\less\normalize.less
" file (Error code: ENOENT). Use --force to continue.

all I'm trying to do is include the bootstrap.css file

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/300#issuecomment-50349281

tonyeung commented 9 years ago

I'll try that, either way, thanks for the info regarding why it blows up. I'll check out the sourcemap to see if they are using absolute paths or something and try the force flag when I get home and post the results.

searls commented 9 years ago

If all else fails you can try to switch to grunt-contrib-concat

Best approach there would be to loadNpmTask it and then set up an alias from "concat" to "concat_sourcemap" so that it takes its place.

On Mon, Jul 28, 2014 at 11:05 AM, tonyeung notifications@github.com wrote:

I'll try that, either way, thanks for the info regarding why it blows up. I'll check out the sourcemap to see if they are using absolute paths or something and try the force flag when I get home and post the results.

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/300#issuecomment-50350693

paulforbes42 commented 9 years ago

Ran into this issue as well today. For now, I'm just downloading bootstrap.min.css from it's CDN and checking it into my project, but I'll keep an eye on this ticket to see if others have a decent work around.

george-i commented 9 years ago

Not fancy, but I manually copied "less" directory under "dist/css/" Not really related to Lineman, more to bower or bootstrap package..