Git Product home page Git Product logo

deadsimple-less-watch-compiler's People

Contributors

badcrocodile avatar calebwhiting avatar daniloster avatar dependabot[bot] avatar jm-agrimap avatar jonycheung avatar kamil-wojcik avatar michaelvashchinsky avatar mikestreety avatar minimit avatar misiur avatar monkeywithacupcake avatar optama avatar renovate-bot avatar spezzino avatar stil4m avatar wizzyrea avatar xtyrrell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deadsimple-less-watch-compiler's Issues

npm install not working

$ 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

Filesearch.js Syntax error

Defects:

  • Did you run npm install and npm update
  • Did you pull the latest code from master branch?

Steps to reproduce:

Ran command to compile less according to readme

Actual Results:

  • Syntax error Unexpected Token [ Line 15 of filesearch.js let [ , filename ] = m;

Expected Results:

  • A colleague of mine uses this repo and works for him, however after looking into file structure it was noticed that he doesn't even have a filesearch.js in lib directory, so must have been an update since he installed which is causing the error.

Cannot find module './src/common'

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.

screen shot 2018-02-07 at 5 07 07 pm

less-watch-compiler returns error code 0 for less compilation errors

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

In watch mode it make sense to just log error but in run-once process should exit with error code so that calling process could handle failure. Ex in CI env.

Steps to reproduce:

  • mkdir -p example && echo error > example/example.less
  • less-watch-compiler example example --run-once

Actual Results:

  • less-watch-compiler logs error and exists with code 0 (success)

Expected Results:

  • less-watch-compiler logs error and exits with code 1(non zero)

missing option: included paths

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 "../.. ":)

Unable to detect new directories

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:

  • (Project created with create react app)
  • Run the compiler
  • Create new directory
  • create xxx.less inside

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:

  • The less file is not parsed

Expected Results:

  • A .css file should be created

Watch a directory and compile .less from a sub folder

Defects:

  • Did you run npm install and npm update
  • Did you pull the latest code from 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?

Windows 7 - after compiling creates undeleteable folder with ".."

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:

    1. Created config file
      {
      "watchFolder" : "../less",
      "outputFolder" : "../css",
      "mainFile" : "styles.less",
      "minified" : false
      }
    1. folder and files structure:
      /css/styles.css
      /incl/less.config.json
      /less/styles.less (+ other in styles.less included less files)
    1. run less-watch-compiler --config less.config.json

Actual Results:

  • After the less file was changed and scripts run, it creates a new folder "css.." inside the project. This folder is undeletedable.

Watching directory for changes, but don't react on changes made

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

Package relies on config.json to be present

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.

Error: EISDIR: illegal operation on a directory

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.

Exlcude node_modules?

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?

Subdirectories are not processed

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

line 60:

      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

line 62:

      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

MaxListenersExceededWarning

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:

  1. My folder setup is ...
    ─ tests
    └── css
    │ └─ styles.css
    └───less
    └─ styles.less
  2. The command I ran is less-watch-compiler --config less-watch-compiler.config.json
  3. Something went wrong... What is it?
    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):

  • OS: Mac OSX 10.14.5
  • On windows (lates) it was actually crashing machine

Error: processes .svn directories

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:

  • create a folder with a name starting with a dot, e.g. '.svn'

Actual Results:

  • less-watch-compiler crashes because it treats such a folder as a file

Expected Results:

  • less-watch-compiler ignores folders with '.' names altogether

concat and minify result files

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?

Output unminified CSS and keep file description

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

Initial launch uses a different directory as watcher

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.

Error: ENOENT: no such file or directory

Defects:

  • Did you pull the latest code from master branch?
  • Did you run npm install and npm update

Steps to reproduce:

Rename file in the <source_dir>, even when this file is not imported in the main less file

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:

  • No errors

less-compile-watch with third argument "main file" tries as many watch tasks as there are files

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.

Recompile imported LESS files when changed

  • 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:

  • None of these cases work

Expected Results:

  • The should work

Using with create react app

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:

  • ability to run less watch compiler only once when needed, without the actual watching, since this enables me to use the same tool when building (autoless has this).
  • ability for watcher to recursively go through the given src directory, compile files and reproduce that structure in the given dst directory. Hmm this is probably tricky because it may compile again files that were already imported in some other file? I guess there could be an option to compile only those that are not imported by the others.

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!

Feature: Option to include warning message in compiled CSS file

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

Error on multiple PC's

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

Changes to files that are imported are not propagated

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.

Compiler creating css in wrong directory

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:

  1. Upgrade from 1.8.0 to 1.11.0
  2. Watch LESS, with npm: "less-watch-compiler src/less public/css"
  3. Edit any file

Actual Results:

  • Output is created in the wrong directory. It appears to be concatenating the arguments weirdly.

The file: src\less\index.less was changed. Recompiling public/csssrc\less/index.css at 19:28:34 on 06/03/2018

Expected Results:

  • Output to be created in public/css/index.css

Note:
This is on Windows

Error if less file has space in name

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:

  1. Create a less file with the name "some styles.less", in a directory named "less"
  2. 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:

  • all valid files names should work.

Command line/Json options

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?

--run-once

less-watch-compiler - 1.10.0
node - 6.11.2 and 8.9.3

Steps to reproduce: [with example repo]

Actual Results:

  • no files created in src/stylesheets/css

Expected Results:

  • should create css files in src/stylesheets/css

P.S. if don't use such option and run in watch, and execute and then change file -> it save a output :)

less compilation with css-modules

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?

Allow custom name for destination file

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!

Feature Request/Idea

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.

node v6 seems to cause zero byting of files

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?

Less files in subfolders are not created on initial run

NPM - less-watch-compiler v1.10.2

Steps to reproduce:

  • Delete the public folder
  • Create file in subfolder src/css/file1.less
  • Create file in subfolder src/css/subfolder/file2.less
  • Command: less-watch-compiler src/css public/css

Actual Results:

  • public/css/file1.css is created
  • The "subfolder" and "file2.css" are not created

Expected Results:

  • "subfolder" and "file2.css" are created on first run

Note:

  • If you modify "file2.css" then it will be created

Diagnosis:

  • I think that on line #58 of src/lib/lessWatchCompilerUtils.js
    lessWatchCompilerUtilsModule.walk(f, options, callback);
    Should include the initCallback
    lessWatchCompilerUtilsModule.walk(f, options, callback, initCallback);

Error: EISDIR: illegal operation on a directory

Defects:

  • Did you run npm install and npm update
  • Did you pull the latest code from master branch?

Steps to reproduce:

Create a new file in the <source_dir>

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:

  • No errors

Support files other then .less

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?

Can't run "less-watch-compiler" command anymore

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:

  1. yarn add less-watch-compiler
  2. 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:

  • run "less-watch-compiler" command as in 1.11.3.
$ 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"
  },

files that @import a changed file are not updated

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.

Folder structure of output folder doesn't fit to the source folder

Defects:

  • Did you run npm install and npm update
  • Did you pull the latest code from master branch?

Steps to reproduce:

  • Create folder structure like this:
styles
|-- components
|---- buttons.less
|-- app.less
|-- index.less
  • Compile/watch the less by 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

failing test

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.