1
resposta

NAO EXIBE O ERRO QDO O GULP TENTA COMPILARO ARQUIVO LESS

Já testei e funciona a criação do arquivo estilos.css a partir de um less, mas não exibe erro qdo tem erro no arquivo less.

gulp.watch('src/less/*.less').on('change', function(qualquerNomeDeEvent){
        //exibe o arquivo modificado
        console.log(qualquerNomeDeEvent.path);
        gulp.src(qualquerNomeDeEvent.path)
            .pipe(less().on('error', function(erro){
                console.log('problema na compilação: '+ erro.message);
            }))
            .pipe(gulp.dest('src/css'));


    });

tem alguma coisa a ver por eu estar usando o VS COde e ele ja informar erro no arquivo less ou por eu n ter tratado os outros erros do arquivo.css?

trecho do arquivo less:

@cor-especial #dcdcdc;

log do terminal:

PS C:\Cursos\alura-gulp-automacao-de-tarefas-front-end\01-capitulo\projeto> npm run gulp server

> projeto@1.0.0 gulp C:\Cursos\alura-gulp-automacao-de-tarefas-front-end\01-capitulo\projeto
> gulp "server"

[11:25:37] Using gulpfile C:\Cursos\alura-gulp-automacao-de-tarefas-front-end\01-capitulo\projeto\gulpfile.js
[11:25:37] Starting 'server'...
[11:25:37] Finished 'server' after 115 ms
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://10.0.0.0:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 --------------------------------------
[Browsersync] Serving files from: src
C:\Cursos\alura-gulp-automacao-de-tarefas-front-end\01-capitulo\projeto\src\less\estilos.less
C:\Cursos\alura-gulp-automacao-de-tarefas-front-end\01-capitulo\projeto\src\css\estilos.css
[11:25:47] 

csslint: There are 22 problems in C:\Cursos\alura-gulp-automacao-de-tarefas-front-end\01-capitulo\projeto\src\css\estilos.css.

estilos.css
1: error at line 1, col 1
Unknown @ rule: @cor-especial.
@cor-especial #dcdcdc;

estilos.css
2: warning at line 17, col 3
Using width with padding-right can sometimes make elements larger than you expect.
  padding-right: 35px;

estilos.css
3: warning at line 35, col 3
margin can't be used with display: inline.
  margin: 0 0 0 20px;

estilos.css
4: warning at line 48, col 8
Heading (h2) should not be qualified.
.busca h2,

estilos.css
5: warning at line 50, col 21
Heading (h2) should not be qualified.
.menu-departamentos h2 {

estilos.css
6: warning at line 50, col 21
Heading (h2) has already been defined.
.menu-departamentos h2 {

estilos.css
7: warning at line 79, col 9
Heading (h2) has already been defined.
.painel h2 {

estilos.css
8: warning at line 79, col 9
Heading (h2) should not be qualified.
.painel h2 {

estilos.css
9: warning at line 101, col 3
Using width with padding can sometimes make elements larger than you expect.
  padding: 10px;

estilos.css
10: warning at line 142, col 3
Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.  text-indent: -9999px;

estilos.css
11: warning at line 144, col 10
Attribute selectors with *= are slow!
.social a[href*="facebook.com"] {

estilos.css
12: warning at line 147, col 10
Attribute selectors with *= are slow!
.social a[href*="twitter.com"] {

estilos.css
13: warning at line 150, col 10
Attribute selectors with *= are slow!
.social a[href*="plus.google.com"] {

estilos.css
14: warning at line 175, col 9
Heading (h2) should not be qualified.
.painel h2:before {

estilos.css
15: warning at line 187, col 9
Heading (h2) should not be qualified.
.painel h2 {

estilos.css
16: warning at line 187, col 9
Heading (h2) has already been defined.
.painel h2 {

estilos.css
17: warning at line 194, col 9
Heading (h2) should not be qualified.
.painel h2 {

estilos.css
18: warning at line 194, col 9
Heading (h2) has already been defined.
.painel h2 {

estilos.css
19: warning at line 204, col 3
Fallback background-color (hex or RGB) should precede RGBA background-color.
  background-color: rgba(255, 255, 255, 0.8);

estilos.css
20: warning at line 284, col 9
Heading (h2) should not be qualified.
.painel h2 {

estilos.css
21: warning at line 284, col 9
Heading (h2) has already been defined.
.painel h2 {

estilos.css
22: warning
You have 6 h2s defined in this stylesheet.
[Browsersync] Reloading Browsers...
`
1 resposta

Fala ai Rogerio , tudo bem? Não entendi, pelo que eu vi o Gulp está logando o erro para você:

estilos.css
1: error at line 1, col 1
Unknown @ rule: @cor-especial.
@cor-especial #dcdcdc;

Consegue explicar com mais detalhes a dúvida?

Fico no aguardo e desculpe o mal entendimento da mesma.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software