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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: WEIgnore (#589) #1250

Merged
merged 1 commit into from Jun 27, 2014
Merged

Feature: WEIgnore (#589) #1250

merged 1 commit into from Jun 27, 2014

Conversation

am11
Copy link
Contributor

@am11 am11 commented Jun 27, 2014

Fixes #589, #638, #1241 and this UserVoice ticket.


The docs should go to http://www.github.com/madskristensen/vswebessentials.com/ which would eventually appear at http://www.vswebessentials.com/.


WEIgnore

WEIgnore, .weignore, is a file containing the list of linefeed-separated file-path patterns to prevent compilers and linters used in Web Essentials (WE). As per @nschonni's kind suggestion and @SLaks' cool Minimatch utility -- a port of Nodejs' minimatch; it supports both Unix-like and Windows-like file paths.

That said, it supports all styles supported by .jshintignore.

Limitations:

Currently it only targets nodejs pipeline services, meaning TypeScript compilation (not TSLint) and Markdown are out. For markdown, we would probably shift to nodejs-based marked compiler, once this feature is implemented.

Discoverability:

It works just like .jscs,.jshintrc, coffee.json, coffeelint.js and tslint.json. For each request, it looks for .weignore file in the current directory, then its parent till the drive's root. After that it will look into user's HOME directory (c:\users\<your-name>).

How it works:

The first config file that is found in the aforementioned chain takes effect. All the file-path patterns inside the .weignore file are relative to the source file being processed, not the .weignore file itself.

Basic Usage:

  • To ignore file path including the word "style":
**/**style**
  • To ignore path with .min.js at the end:
**/**.min.js
  • To ignore file path including the folder name "slug":
**\slug\**

or:

**/slug/**
  • To ignore the absolute path:
C:\temp\foo.ts

Or:

C:/temp/foo.ts

Intermediate Complexity:

  • To negate the ignore, use ! before the path:
!**/**Content
  • To ignore the file from any kind of compilation (only), specify the term "compiler" after the pattern, separated by TAB:
**/doodle.less  compiler

Note: The space between doodle.less and compiler is a TAB \t. Although TAB is not the disallowed character in any major file-system, but it's extremely obscure in usage -- hence the best candidate of our separator. If you have files with TAB anywhere file path, you are out of luck! :(

  • To ignore the file from being processed by LESS compiler, use the word less:
**/doodle.less  less
  • To ignore the file from being processed by Autoprefixer, use the word autoprefixer:
**/bug.scss autoprefixer
  • To ignore the file from being processed by a linter, use the word linter:
**/*.js linter
  • You can also specify a linter's name:
**/random.js    jscs
  • If there a case which requires specifying multiple service names, use comma-separated list:
**/doodle.less  less, autoprefixer

Here is the list of all the (node-based) compilers and linters currently supported by WE:

  • compiler
    • autoprefixer
    • coffeescript
    • icedcoffeescript
    • less
    • livescript
    • scss
    • sweetjs
  • linter
    • jscs
    • jshint
    • tslint

The parent list items are referred as "service-categories" and sub-list constitutes "service-names".

Advanced Usage (going crazy):

You can have negation for service type and service names as well!

**/doodle.less  !less, autoprefixer

It will only ignore autoprefixer.

But this:

!**/*.coffee    !coffeescript

will not ignore coffeescript compilation, because the negation of pattern will take precedence. We can implement this logic, if its really desired. Meanwhile, it is recommended to keep your logic simplified (see this Wolfarm|Alpha's logic expression simplifier).

Precedence:

As describe above, it first skips the negative patterns (those starting with exclamation mark !).

Then it looks for service-category or service-name. If none is found, it moves on to test the pattern match.

If there was tab-separated service category/name specified on the line, before matching the pattern, it checks if the caller service needs to be ignored (or that it has !) and skips accordingly.

Take it for a spin with v2.2.3+ ........ 馃殫

madskristensen added a commit that referenced this pull request Jun 27, 2014
@madskristensen madskristensen merged commit e237f89 into madskristensen:master Jun 27, 2014
@bogacg
Copy link

bogacg commented Dec 17, 2014

Multiple negations in .weignore file

I want to produce two distinct css files from what I have in less folder. So I made a .weignore file such this:

!**/bootstrap.less  less
!**/bootstrap-cosmo.less    less
**/**.less  less

It didn't work out. It produces bootstrap.css but not bootstrap-cosmo.css
When I reverse negate order it works for bootstrap-cosmo.less but not bootstrap.less.
Only first one.
I'm on latest (for Update 4) Web Essentials 2013.

Thanks

@persun
Copy link

persun commented Jan 15, 2015

I have the same problem.

@aseminario
Copy link

Same problem with 2 negations.

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

Successfully merging this pull request may close these issues.

Feature - Ignore LESS and SASS files from compilation
5 participants