adopted-ember-addons / broccoli-sass-source-maps Goto Github PK
View Code? Open in Web Editor NEWThis project forked from joliss/broccoli-sass
Sass compiler for Broccoli, using libsass
License: MIT License
This project forked from joliss/broccoli-sass
Sass compiler for Broccoli, using libsass
License: MIT License
related issue: ember-cli/ember-cli#9639 (comment)
TLDR: dart-sass always put cwd as first step resolution path, and this is wrong behavour for broccoli build (we should have input tree as cwd)
workaround: replace cwd during sass build
When I run npm update
, I got this warning:
npm WARN unmet dependency /home/vanitas/media-helper/frontend/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass requires mkdirp@'^0.5.0' but will load
npm WARN unmet dependency /home/vanitas/media-helper/frontend/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.3.5
Could you please update the mkdirp dependency version?
We're using broccoli-sass-source-maps
via ember-cli-sass
. Because the version of broccoli-sass-source-maps
is unpinned in ember-cli-sass
and the version of node-sass
is unpinned in broccoli-sass-source-maps
. So even if we pin ember-cli-sass
errors that go into node-sass
can still surface (for example sass/node-sass#1442).
I don't know if pinning to specific versions all the way down the chain is a great solution, but do you have any thoughts on how to better manage this?
**Sass Syntax Error (SassCompiler)
sourceMapFile.replaceAll is not a function**
The issue is not there in the previous version and occurs only in the updated version. Please let us know if there any updates on the same.
Sass have changed a bit how they deal with source maps in their new Dart implementation.
broccoli-sass-source-maps
still exposes the old deprecated options, like sourceMapEmbed
. I've been checking the code and I can see that one option is being converted into sourceMapIncludeSources
, for example. It also passes some options like sourceMapContents
and sourceMapRoot
that Dart Sass doesn't support, those could probably be removed from the options object.
The issue is that Dart Sass is no longer automatically adding the source map to the generated file. It says so in their documentation. Copied from there:
Sass doesn’t automatically add a sourceMappingURL comment to the generated CSS. It’s up to callers to do that, since callers have full knowledge of where the CSS and the source map will exist in relation to one another and how they’ll be served to the browser.
As far as I can tell, broccoli-sass-source-maps
doesn't take care of this, and in the end the browser never loads the source map. I've also tried with the sourceMapEmbed
/sourceMapIncludeSources
option, but without any luck, it doesn't work either.
I happens with both sass and sass-embedded NPM packages.
If I use node-sass with the same configuration, then the source maps work fine.
TypeError: Cannot read property 'annotation' of undefined
shows up when following instructions to use
This commit broke it
Happening because it expects the options
parameter to exist, which the documentation shows as an optional parameter (which it used to be)
var appCss = compileSass(['styles', 'vendor'], 'myapp/app.scss', 'assets/app.css');
I could make the that parameter optional, like it was before f2fcc48
Let me know if i should do that, and thanks for the project, source map good. :) 👍
Hello,
Thank you for your library.
If there is something I like about broccoli is how it is just a file transformer, making the task of just transpiling files very easy and transparent. For me it is key that it just takes a folder as an input and produces the same folder structure as an output. This module does not follow that convention and forces me to include both an input tree, to select a list of files (why? doesn't that taken care on the tree ?) and to specify an output file. I would love to just take the scss files and turn them into css files on the output directory on the same path. Seems that this plugin is only able to produce one single output file, what If I have several scss input files and want several css output files ?
Thanks in advance
This commit ec0afe2 breaks our builds we have to do with npm version 6.14.16
The error is:
ERROR Summary:
- broccoliBuilderErrorStack: [undefined]
- code: [undefined]
- codeFrame: [undefined]
- errorMessage: Unexpected token '?'
- errorType: [undefined]
- location:
- column: [undefined]
- file: [undefined]
- line: [undefined]
- message: Unexpected token '?'
- name: SyntaxError
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: /builds/educube/nextclassroom/node_modules/broccoli-sass-source-maps/index.js:62
sourceMapIncludeSources: options.sourceMapIncludeSources ?? true,
^
SyntaxError: Unexpected token '?'
at compileFunction (<anonymous>)
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/builds/educube/nextclassroom/node_modules/ember-cli-sass/index.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:999:30)
Due to a known libsass issue, users of ember-cli-sass will currently get segfaults when using node.js 0.12
The fix for this is to NOT use node-sass ~3.5.0. While acknowledging that the root cause of the problem does not lie with this library, I suggest changing the constraint in your package.json to ~3.4.2
or something, to prevent users from having a bad experience.
Fix in #62
2.x release is not in master
Dart Sass is in Release Candidate phase now, with a full release probably coming next week. It would be great to add support to this package for choosing between Node Sass and Dart Sass. I'm willing to create a pull request, but I'm not sure what the best design would be.
Right now, this package has a nodeSass
option that can be configured, but because it includes Node Sass in its dependencies, this still requires users to get Node Sass even if they want to use Dart Sass—which is often be a big pain, since that can involve building C code. One way around this would be to remove Node Sass as a dependency and require users to pass in the version of the compiler they want to use, either using the existing API or using something like
var sass = require('broccoli-sass-source-maps')(require('dart-sass'));
I have an issue with multiple apps using ember-cli-sass
and the latest versions of all of node, npm, libsass and this library (via updated ember-cli-sass). I tried everything I could come up with in order to fix it, but it keeps failing with the follow stack trace, whenever I try to build and/or watch one of these apps:
~/src/remotestorage/apps/dashtab $ ember build
Future versions of Ember CLI will not support v5.0.0. Please update to Node 0.12 or io.js.
version: 1.13.8
Build failed.
ENOENT: no such file or directory, stat '/home/basti/src/remotestorage/apps/dashtab/tmp/sass_compiler-input_base_path-VTbfcUKS.tmp/0/vendor/.bin/indent-string'
Error: ENOENT: no such file or directory, stat '/home/basti/src/remotestorage/apps/dashtab/tmp/sass_compiler-input_base_path-VTbfcUKS.tmp/0/vendor/.bin/indent-string'
at Error (native)
at Object.fs.statSync (fs.js:892:18)
at SassCompiler.keyForFile (/home/basti/src/remotestorage/apps/dashtab/node_modules/broccoli-sass-source-maps/node_modules/broccoli-caching-writer/index.js:91:55)
at Array.map (native)
at SassCompiler.CachingWriter._conditionalBuild (/home/basti/src/remotestorage/apps/dashtab/node_modules/broccoli-sass-source-maps/node_modules/broccoli-caching-writer/index.js:107:61)
at /home/basti/src/remotestorage/apps/dashtab/node_modules/broccoli-sass-source-maps/node_modules/broccoli-plugin/read_compat.js:61:34
at lib$rsvp$$internal$$tryCatch (/home/basti/src/remotestorage/apps/dashtab/node_modules/rsvp/dist/rsvp.js:493:16)
at lib$rsvp$$internal$$invokeCallback (/home/basti/src/remotestorage/apps/dashtab/node_modules/rsvp/dist/rsvp.js:505:17)
at lib$rsvp$$internal$$publish (/home/basti/src/remotestorage/apps/dashtab/node_modules/rsvp/dist/rsvp.js:476:11)
at lib$rsvp$asap$$flush (/home/basti/src/remotestorage/apps/dashtab/node_modules/rsvp/dist/rsvp.js:1198:9)
[deleted]
indent-string in that dir exists, but seems to be a wrong symlink:
tmp/sass_compiler-input_base_path-oemkgqKh.tmp/0/vendor/.bin/indent-string -> ../indent-string/cli.js
Update: the whole library seems to be present in the linked directory, but it only contains an index.js
and no cli.js
.
Update 2: This happened in July: sindresorhus/indent-string@4322f1a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.