jonycheung / deadsimple-less-watch-compiler Goto Github PK
View Code? Open in Web Editor NEWA nodejs script that allows you to watch a folder for changes and compile the less css files into another folder.
License: MIT License
A nodejs script that allows you to watch a folder for changes and compile the less css files into another folder.
License: MIT License
Hi,
I have install the less-wacher-compiler and it seems all right until I call the command to start watcher. Then it get stuck on "Watching directory for file changes.", and I make changes on my less-folder less-files, but nothing happens on terminail.
Any suggestions?
BR
Elliott
upgrading node to v6.0.0 seems to cause the less compiler to produce zero-byte files; tried the native tests and running them produced following error:
> [email protected] test /Users/example/Downloads/deadsimple-less-watch-compiler-master
> cd tests && mocha
lessWatchCompilerUtils Module API
Should have the following API's
walk()
✓ walk() function should be there
1) walk() function should return an object of files
watchTree()
✓ watchTree() function should be there
2) watchTree() function should complete and call a callback
compileCSS()
✓ compileCSS() function should be there
✓ should run the correct command with minified flag
filterFiles()
✓ filterFiles() function should be there
✓ filterFiles() function should return "false" for allowed files
✓ filterFiles() function should return "true" for non-allowed files
getDateTime()
✓ getDateTime() function should be there and has value
8 passing (16ms)
2 failing
1) lessWatchCompilerUtils Module API Should have the following API's walk() walk() function should return an object of files :
TypeError: path must be a string or Buffer
at TypeError (native)
at Object.fs.stat (fs.js:967:11)
at Object.lessWatchCompilerUtilsModule.walk (/Users/example/Downloads/deadsimple-less-watch-compiler-master/lib/lessWatchCompilerUtils.js:27:18)
at Context.<anonymous> (test.js:17:36)
2) lessWatchCompilerUtils Module API Should have the following API's watchTree() watchTree() function should complete and call a callback :
TypeError: path must be a string or Buffer
at TypeError (native)
at Object.fs.stat (fs.js:967:11)
at Object.lessWatchCompilerUtilsModule.walk (/Users/example/Downloads/deadsimple-less-watch-compiler-master/lib/lessWatchCompilerUtils.js:27:18)
at Object.lessWatchCompilerUtilsModule.watchTree (/Users/example/Downloads/deadsimple-less-watch-compiler-master/lib/lessWatchCompilerUtils.js:71:44)example at Context.<anonymous> (test.js:35:36)
npm ERR! Test failed. See above for more details.
Running OS X 10.11.4 / Mac Pro; reverting to Node 5.11.0 seems to allow it to work.
Anyone else encountered this issue?
Defects:
npm install
and npm update
master
branch?Steps to reproduce:
styles
|-- components
|---- buttons.less
|-- app.less
|-- index.less
less-watch-compiler styles styles
Actual Results:
styles
|-- components
|---- buttons.less
|-- app.less
|-- app.css
|-- buttons.css
|-- index.less
|-- index.css
Expected Results:
styles
|-- components
|---- buttons.less
|---- buttons.css
|-- app.less
|-- app.css
|-- index.less
|-- index.css
NPM - less-watch-compiler v1.10.2
Steps to reproduce:
Actual Results:
Expected Results:
Note:
Diagnosis:
lessWatchCompilerUtilsModule.walk(f, options, callback);
lessWatchCompilerUtilsModule.walk(f, options, callback, initCallback);
Version 3.0.4 of less is not yet a very good and stable release.
They have broken things like aspect ratios, see:
less/less.js#1880
Having a media query like the following breaks because it is "16/9" is converted to a decimal 1.7777778
@media (max-width: 50em) and (max-aspect-ratio: 16/9)
Is this still being maintained? Because it says "dead"?
Are you using the command line tool less-watch-compiler
? no, it's integrated with npm
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)? yes, freshly installed with npm install
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)? yes
Upon checkout, my folder tree contains lots of '.svn' directories.
Steps to reproduce:
Actual Results:
Expected Results:
Is it possible to specifiy mutliple main files within the config.json file?
I am experiencing the same problem with every version > 1.4
(1.4.2
works ok).
Just set the watchFolder
to be relative:
./less
../src/less
(in my case)
and the exception is thrown.
Debugging the code of the latest version (1.10
) I encountered the following code in lessWatchCompilerUtils.js:184
:
fileWatcher: function fileWatcher(f, files, options, filelist, fileimportlist, watchCallback) {
if (filelist.indexOf(f) !== -1) return;
filelist[filelist.length] = f;
if (f.indexOf('.') !== -1) {
fileimportlist[f] = fileSearch.findLessImportsInFile(f);
}
lessWatchCompilerUtilsModule.setupWatcher(f, files, options, watchCallback);
for (var i in fileimportlist[f]) {
if (filelist.indexOf(fileimportlist[f][i]) === -1) {
lessWatchCompilerUtilsModule.setupWatcher(path.normalize(path.dirname(f) + '/' + fileimportlist[f][i]), files, options, watchCallback);
}
}
}
this function is called (probably the first time) with f
set to the watchFolder
and the second if
(if (f.indexOf('.') !== -1)
) will resolve to true
if f
has .
inside it (and every relative folder name does) calling fileSearch.findLessImportsInFile(f)
which will fail by calling fs.readFileSync(f, 'utf8')
in filesearch.js:15
.
The condition if (f.indexOf('.') !== -1)
if pretty fragile one. Why not checking if f
is a directory?
Changing the condition to if (f.lastIndexOf('.') > 2)
solves the problem for me, but it's a hack.
Thank you.
if you check http://lesscss.org/#getting-started
var less = require('less');
less.render('.class { width: (1 + 1) }',
{
paths: ['.', './lib'], // Specify search paths for @import directives
filename: 'style.less', // Specify a filename, for better error messages
},
function (e, output) {
console.log(output.css);
});
there is missing config - if you got app.less which has dependency lets say layout.less [which is located not in same dir] and you do @import ".../layout" inside app.less, it will do not work, as it do have this path included, to make it work you need todo a lot of ../../ stuff to navigate to the right file, but if you would have an option to include directories which need to scan for includes, then all should work without many "../.. ":)
Defects:
master
branch?npm install
and npm update
Steps to reproduce:
Actual Results:
fs.js:652
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open 'C:\Users\Sergio\Documents\projects\starwind-resource-library\src\less\base.less'
at Object.fs.openSync (fs.js:652:18)
at Object.fs.readFileSync (fs.js:553:33)
at Object.findLessImportsInFile (C:\Users\Sergio\AppData\Roaming\npm\node_modules\less-watch-compiler\lib\filesearch.js:11:40)
at StatWatcher.<anonymous> (C:\Users\Sergio\AppData\Roaming\npm\node_modules\less-watch-compiler\lib\lessWatchCompilerUtils.js:95:54)
at emitTwo (events.js:125:13)
at StatWatcher.emit (events.js:213:7)
at StatWatcher._handle.onchange (fs.js:1452:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @1.0.0 watch-css: `less-watch-compiler src/less public/css style.less --source-map`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @1.0.0 watch-css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sergio\AppData\Roaming\npm-cache\_logs\2017-08-14T14_34_17_645Z-debug.log
Expected Results:
less-watch-compiler - 1.10.0
node - 6.11.2 and 8.9.3
Steps to reproduce: [with example repo]
Actual Results:
Expected Results:
P.S. if don't use such option and run in watch, and execute and then change file -> it save a output :)
Is it possible to pass the --source-map
option to the less compiler?
I have a directory called css which contains LESS and CSS files, as well as another directory (libs).
It looks like the directory recursion part is not working.
None of the files in libs are processed,
Looking at the code
callback.pending -= 1;
done = callback.pending === 0;
if (!enoent) {
if (options.ignoreDotFiles && path.basename(f)[0] === '.') return done && callback(null, callback.files);
/* this causes the problem? */
if (options.filter && options.filter(f, stat)) return done && callback(null, callback.files);
callback.files[f] = stat;
if (stat.isDirectory()) {
walk(f, options, callback);
}else{
initCallback&&initCallback(f);
}
the filter check is done before it checks if the current entry is a directory. The filter will fail it because it does not have a correct 'extension', so subdirectories never get processed.
I changed it to
if (!enoent) {
if (stat.isDirectory()) {
callback.files[f] = stat;
walk(f, options, callback, initCallback); // <------- Also note I added the 4th param!!
}else{
if (options.ignoreDotFiles && path.basename(f)[0] === '.') return done && callback(null, callback.files);
if (options.filter && options.filter(f, stat)) return done && callback(null, callback.files);
callback.files[f] = stat;
initCallback && initCallback(f);
}
Note that adding the 4th param to walk() makes it also process the subdir files at startup.
Now that the subdirectory scan is fixed, another problem pops up.
Assume the following dir structure:
work_dir
work_dir/css
work_dir/css/sub1
if this script is run like this:
node "less-watch-compiler.js" css css
the css files found in css/sub1 will be compiled and the resulting css will be placed in work_dir/css!
In other words, the file [work_dir/css/sub1/dooda.less] will be compiled into [work_dir/css/dooda.css] instead of [work_dir/css/sub1/dooda.css]
The solution is to create the output file in the same place the .LESS file was found in.
This also requires changing the script as follows
var extension = getFileExtension(file);
var command = '';
var outFilename = file.replace(/\s+/g,"\\ ");
outFilename = outFilename.replace('.less', '.css');
if (extension === 'less') {
command = "lessc " + file.replace(/\s+/g,"\\ ") + " " + outFilename;
This is probably not the correct way to submit changes but I did not want to alter the actual source stored here.
If you are familiar with the process of modifying the source in this repository, please apply these updates.
Cheers,
Nick
Which version are you using (less-watch-compiler --version to find out)?: 1.13.0
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler)? Yes
Describe the bug
Does not work with css-modules.
.aClass {
width: 100%;
display: flex;
:global {
.bClass {
font-size: 14px;
}
}
}
gets compiled into
.aClass{
width: 100%;
display: flex;
}
.aClass :global .bClass {
font-size: 14px;
}
Could you please share how to handle scoped variables?
Reference import
@import (reference) "theme.less"
These are not recognised by the regex in filesearch.js
Relative and absolute imports
@import "../theme.less"
@import "/theme.less"
If you reference a LESS using relative or absolute path
Excluding the .less extension when referring to files
``````@import "theme"```
This is recognised by the compiler but the comparison in less-watch-compiler.js line 119 does not work
http://lesscss.org/features/#import-directives-feature
Actual Results:
Expected Results:
Watching directory for file changes.
C:\Users\Vasil\AppData\Roaming\npm\node_modules\less-watch-compiler\lib\lessWatchCompilerUtils.js:72
if (err) throw err;
^
Error: ENOENT: no such file or directory, stat 'C:\Projects\Less course\First\styles\less\styles\less'
at Error (native)
ON MULTIPLE PC's
I am using this command:
node_modules/.bin/less-watch-compiler src/assets/less/ ./ qbo.less
it generates the qbo.less
at the root directory of my project. When a file is changed, the watcher generates the file under src/assets/less
directory. It looks like they are using different path algorithm.
package.json call:
{
...
"scripts": {
...
"client:less": "less-watch-compiler apps/client/web/css/less apps/client/web/css style.less",
...
},
...
}
result on Windows 7, running it for a source dir with 9 files:
$> npm run client:less
Watching directory for file changes.
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"
The process cannot access the file because it is being used by another process.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "lessc -x apps/client/web/css/less/style.less > apps/client/web/css/style.css"' }
Game server listening on port 8081
It looks like it's seeing nine files, and sees a main entry, then runs a watch task using the main entry nine times instead of only once, so that the first watch tasks works, and then the subsequent eight fail because there's already a watch task attached to the main file.
Hello,
Thank you for this small script, it will be useful to speed up my project.
I'd like to output unminified stylesheets, as I already have a minifying process otherwhere. Also, I'm used to start all my files with something like
`/**
and the compiling process strip out this comment... Is it possible to keep it?
Thank you for your help
I feel like there is already a way to do this but I'm not sure of it:
It would be great if a custom output name were possible. For instance:
less-watch-compiler src dist main.less main.min.css
would produce main.min.css
instead of main.css
.
Thank you!
If I have a directory with two files, a.less
and b.less
, where a.less
has an @import "b.less";
instruction, running this watcher on the less directory will not lead to a.less
being recompiled when b.less
is saved, essentially voiding the very reason to use it.
The third-arg-for-main-entry-point works if you have a less dir with a single "master" file, but only pushes the problem a bit further out: if there are two or more master files (for instance, you have a project with multiple themes that all rely on the same colors.less
or something) then you still run into this problem where only one theme will get recompiled and the rest just sit there doing nothing.
A list of "master files" that all get recompiled when a save happens, rather than just a single file, would be quite useful, although a file parse to find the import hierarchy would of course be the best solution.
Version: 1.13.0
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler)? Yes
Recently started working on a project using this and had never used less before. Started changing the .css file for styling changes because we didn't know better.
Would be helpful to have a commented message at the top of the CSS file:
// this is an auto-generated file by less-watch-compiler. This will be overwritten
Can we specify an output file instead of folder? Instead of each .less file compiling into a .css file, i want all .less files to compile into a single .css file. Also, is there an option for the third parameter in the json file?
Nice job on this! Works beautifully.
Here's one thing that would make it even better for my use—and likely others' as well: It would great if the watcher looked in sub-directories as well. This would let me jump around inside of my Less subfolders without having to rerun the watcher.
Other than that though, great tool! Thanks a lot for taking the time to put this one together.
Defects:
npm install
and npm update
master
branch?Steps to reproduce:
Actual Results:
Unexpected Token [
Line 15 of filesearch.js let [ , filename ] = m;
Expected Results:
Are you using the command line tool less-watch-compiler
?
Yes
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)?
1.11.3
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)?
Steps to reproduce:
My scripts:
"build-css": "less-watch-compiler --run-once src/ src/",
"watch-css": "npm run build-css && less-watch-compiler src/ src/",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
Actual Results:
Expected Results:
https://www.npmjs.com/package/less-watch-compiler has the yarn add global examples, but for my ubuntu on windows 10 it didn't add it globally.
yarn add global less-watch-compiler could have a note that on some distro's you'd have to add sudo in front of it, otherwide people end up with command not found errors.
Github has flagged versions of hoek older than 5.0.3 and 4.2.1 as having security vulnerabilities. (See hapijs/hoek#247.) The less
version required by the current version of this package (1.11.2) still contains this as a nested dependency. If less
is updated to the latest version (3.0.4), this vulnerability warning can be avoided.
Defects:
npm install
and npm update
master
branch?Steps to reproduce:
Actual Results:
fs.js:681
return binding.read(fd, buffer, offset, length, position);
^
Error: EISDIR: illegal operation on a directory, read
at Object.fs.readSync (fs.js:681:18)
at tryReadSync (fs.js:542:20)
at Object.fs.readFileSync (fs.js:585:19)
at Object.findLessImportsInFile (C:\Users\Sergio\AppData\Roaming\npm\node_modules\less-watch-compiler\lib\filesearch.js:11:40)
at C:\Users\Sergio\AppData\Roaming\npm\node_modules\less-watch-compiler\lib\lessWatchCompilerUtils.js:106:62
at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @1.0.0 watch-css: `less-watch-compiler src/less public/css style.less --source-map`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @1.0.0 watch-css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sergio\AppData\Roaming\npm-cache\_logs\2017-08-14T14_09_33_358Z-debug.log
npm run watch-css exited with code 1
Expected Results:
Are you using the command line tool less-watch-compiler
?
Yes
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)?
1.11.3
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)?
yes
Steps to reproduce:
yarn less-watch-compiler less css
Actual Results:
Watching directory for file changes.
{ Error: Command failed: lessc less\some\ styles.less css/some\ styles.css
lessc: ENOENT: no such file or directory, open 'C:\dev\b44\src\BloomBrowserUI\less\some'
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:567:12)
killed: false,
code: 1,
signal: null,
cmd: 'lessc less\\some\\ styles.less css/some\\ styles.css' }
Expected Results:
Apologies in advance for reporting this again. I've been looking into the previous error of the zero-byting files I was experiencing; the error was reproducible across multiple OS X and Linux machines. Have tested this in a vanilla OS X VM and the tests are still failing.
Steps to reproduce:
Install Node JS and NPM from http://www.nodejs.org (6.2.0)
download zip
cd into extracted dir
npm install -g less
npm install -g less-watch-compiler
npm test
Experienced Results:
lessWatchCompilerUtils Module API
Should have the following API's
walk()
✓ walk() function should be there
1) walk() function should return an object of files
watchTree()
✓ watchTree() function should be there
2) watchTree() function should complete and call a callback
compileCSS()
✓ compileCSS() function should be there
✓ should run the correct command with minified flag
filterFiles()
✓ filterFiles() function should be there
✓ filterFiles() function should return "false" for allowed files
✓ filterFiles() function should return "true" for non-allowed files
getDateTime()
✓ getDateTime() function should be there and has value
8 passing (15ms)
2 failing
1) lessWatchCompilerUtils Module API Should have the following API's walk() walk() function should return an object of files :
TypeError: path must be a string or Buffer
at TypeError (native)
at Object.fs.stat (fs.js:967:11)
at Object.lessWatchCompilerUtilsModule.walk (/Users/example/Downloads/deadsimple-less-watch-compiler-master/lib/lessWatchCompilerUtils.js:27:18)
at Context.<anonymous> (test.js:17:36)
2) lessWatchCompilerUtils Module API Should have the following API's watchTree() watchTree() function should complete and call a callback :
TypeError: path must be a string or Buffer
at TypeError (native)
at Object.fs.stat (fs.js:967:11)
at Object.lessWatchCompilerUtilsModule.walk (/Users/example/Downloads/deadsimple-less-watch-compiler-master/lib/lessWatchCompilerUtils.js:27:18)
at Object.lessWatchCompilerUtilsModule.watchTree (/Users/example/Downloads/deadsimple-less-watch-compiler-master/lib/lessWatchCompilerUtils.js:71:44)
at Context.<anonymous> (test.js:35:36)
npm ERR! Test failed. See above for more details.
I'm currently relying on Atom to compile my less for me. I've been scratching my head trying to figure out if i'm missing something obvious; the rollback to Node 5.11.0 still allows it to work.
Hello,
When running the less-watch-compiler <source_dir> <destination_dir> command, I get thrown an error immediately. I updated to the latest version (I think?) by running npm update less-watch-compiler
. There was no output in the terminal after running that command. Trying to check the version gives me the same error. I've never seen this error before and don't know what to do! Any suggestions? Thank you.
I suppose it must be an unusual thing, but we would like to run this at the top level of our src and thus need to exclude node_modules. Short of adding a full glob ability, I wonder if you would accept a PR that just automatically excludes node_modules?
Are you using the command line tool less-watch-compiler
? Yes
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)? 1.10.2
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)? Yes
Steps to reproduce:
Actual Results:
Are you using the command line tool less-watch-compiler
? Yes
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)? 1.11.0
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)? Yes
Steps to reproduce:
"less-watch-compiler src/less public/css"
Actual Results:
The file: src\less\index.less was changed. Recompiling public/csssrc\less/index.css at 19:28:34 on 06/03/2018
Expected Results:
public/css/index.css
Note:
This is on Windows
Hi,
I am looking to use this package with create-react-app generated application, since this package is a good way to do it without ejecting the config files (which makes whole process more complicated).
However, the features that I need for that are:
I know I am asking for a lot here, but I was wondering how hard is this to do? From what I read, this is not supported yet, correct?
Since ant design is growing very popular and it is using less, and this plugin enables create-react-app users to add less support without ejecting, this features would make it ideal for that and therefore probably used a lot.
Thanks!
so difficult ,
i don't know how it work
Which version are you using (less-watch-compiler --version to find out)?
npm 6.4.1
node 10.13.0
less 3.9.0
compiler 1.13.0
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler)?
Describe the bug
When running from the command line
less-watch-compiler --config less-watch-compiler.config.json
receive the following response:
Watching directory for file changes. (node:885) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit (node:885) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit
To Reproduce
Steps to reproduce the behavior:
less-watch-compiler --config less-watch-compiler.config.json
Watching directory for file changes. (node:885) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit (node:885) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit
On Mac after initial warning, it runs ok, but Windows machines are freezing.
Desktop (please complete the following information):
Often using libraries such as Semantic-UI, they include .variables
files. Changes to those files should run a new build.
Could/should this plugin watch for files other then .less
?
$ npm --version
5.3.0
ran install and update and still didn't work
$ npm install -g less-watch-compiler
npm ERR! path /usr/local/lib/node_modules/less-watch-compiler/dist/less-watch-compiler.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/less-watch-compiler/dist/less-watch-compiler.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/williamrusnack/.npm/_logs/2017-08-15T11_52_04_687Z-debug.log
The documentation suggests that the config file ist optional but you are trying to access it without checking for existence.
There is a valid lookup for less-watch-compiler.config.json afterwards - I didn't do a pull request because I don't know what's the plan with the other config file name.
i.e. homepage.less which imports theme.less which imports colors.less
As mentioned in Issue #55
Defects:
npm install
and npm update
master
branch?Steps to reproduce:
An example:
I have a mixins.less file that has my favorite color stored in a variable. My footer.less file imports the mixins file so it can use that color variable. When I change my favorite color in mixins I have to manually force footer to recompile.
I would expect the compiler to recompile the files that import files that have changed.
Are you using the command line tool less-watch-compiler
? yes
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)? 1.12.0
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)? yes
Steps to reproduce:
yarn add less-watch-compiler
yarn run less-watch-compiler
Actual Results:
error Command "less-watch-compiler" not found.
$ ll node_modules/.bin/
total 0
drwxr-xr-x 12 adam staff 384 Oct 17 10:36 .
drwxr-xr-x 86 adam staff 2752 Oct 17 10:36 ..
lrwxr-xr-x 1 adam staff 15 Oct 17 10:36 errno -> ../errno/cli.js
lrwxr-xr-x 1 adam staff 31 Oct 17 10:36 image-size -> ../image-size/bin/image-size.js
lrwxr-xr-x 1 adam staff 17 Oct 17 10:36 lessc -> ../less/bin/lessc
lrwxr-xr-x 1 adam staff 14 Oct 17 10:36 mime -> ../mime/cli.js
lrwxr-xr-x 1 adam staff 20 Oct 17 10:36 mkdirp -> ../mkdirp/bin/cmd.js
lrwxr-xr-x 1 adam staff 19 Oct 17 10:36 shjs -> ../shelljs/bin/shjs
lrwxr-xr-x 1 adam staff 23 Oct 17 10:36 sshpk-conv -> ../sshpk/bin/sshpk-conv
lrwxr-xr-x 1 adam staff 23 Oct 17 10:36 sshpk-sign -> ../sshpk/bin/sshpk-sign
lrwxr-xr-x 1 adam staff 25 Oct 17 10:36 sshpk-verify -> ../sshpk/bin/sshpk-verify
lrwxr-xr-x 1 adam staff 16 Oct 17 10:36 uuid -> ../uuid/bin/uuid
Expected Results:
$ ll node_modules/.bin/
total 0
drwxr-xr-x 13 adam staff 416 Oct 17 10:37 .
drwxr-xr-x 86 adam staff 2752 Oct 17 10:37 ..
lrwxr-xr-x 1 adam staff 15 Oct 17 10:37 errno -> ../errno/cli.js
lrwxr-xr-x 1 adam staff 31 Oct 17 10:37 image-size -> ../image-size/bin/image-size.js
lrwxr-xr-x 1 adam staff 50 Oct 17 10:37 less-watch-compiler -> ../less-watch-compiler/dist/less-watch-compiler.js
lrwxr-xr-x 1 adam staff 17 Oct 17 10:37 lessc -> ../less/bin/lessc
lrwxr-xr-x 1 adam staff 14 Oct 17 10:37 mime -> ../mime/cli.js
lrwxr-xr-x 1 adam staff 20 Oct 17 10:37 mkdirp -> ../mkdirp/bin/cmd.js
lrwxr-xr-x 1 adam staff 19 Oct 17 10:37 shjs -> ../shelljs/bin/shjs
lrwxr-xr-x 1 adam staff 23 Oct 17 10:37 sshpk-conv -> ../sshpk/bin/sshpk-conv
lrwxr-xr-x 1 adam staff 23 Oct 17 10:37 sshpk-sign -> ../sshpk/bin/sshpk-sign
lrwxr-xr-x 1 adam staff 25 Oct 17 10:37 sshpk-verify -> ../sshpk/bin/sshpk-verify
lrwxr-xr-x 1 adam staff 16 Oct 17 10:37 uuid -> ../uuid/bin/uuid
There is no dist
directory...
$ ll node_modules/less-watch-compiler/
total 24
drwxr-xr-x 5 adam staff 160 Oct 17 10:40 .
drwxr-xr-x 86 adam staff 2752 Oct 17 10:40 ..
-rwxr-xr-x 1 adam staff 5071 Oct 16 18:14 README.md
drwxr-xr-x 3 adam staff 96 Oct 17 10:40 node_modules
-rwxr-xr-x 1 adam staff 1841 Oct 16 18:14 package.json
but bin
is defined as dist/less-watch-compiler.js
in package.json
:
"bin": {
"less-watch-compiler": "./dist/less-watch-compiler.js"
},
hi i have a little problem
I have some .less files in my app, when i run build-css ("build-css": "less-watch-compiler --v --run-once src/components/ src/styles/") I get the same directory structure as the original with separate .css files. How to merge all the .less files into one and not create many different .css files?
Are you using the command line tool less-watch-compiler
?
If you are using the command line tool, which version are you using (less-watch-compiler --version
to find out)?
1.11.0
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler
)?
yes
Steps to reproduce:
less-watch-compiler example example --run-once
Actual Results:
Expected Results:
Defects:
npm install
and npm update
master
branch?Steps to reproduce:
my files structure is something like this:
apps
-------proj1
---------------main.less (import proj1.less, '../common/1.less', '../common/2.less')
---------------proj1.less
-------common
---------------1.less
---------------2.less
Expected Results:
I want to watch apps, so all changes in 1 of the 3 .less files will be watched,
but my main.less that needs to be compiled is located in a sub directory
is there a way to do that?
I need to pass plugins to lessc command. E.g. lessc --glob
the extra parameter there is less glob plugin.
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.