sass-brunch icon indicating copy to clipboard operation
sass-brunch copied to clipboard

Partials ignored on watch

Open Swizz opened this issue 8 years ago • 5 comments

Hi,

I do not know if I am doing something wrong, but my partials do not raise update on brunch watch.

Do I need to declare any rule in the brunch config ? Is this feature unsuported yet ?

Thanks for your answers.

Regards,

Swizz avatar Jun 10 '16 08:06 Swizz

It is a supported feature. Can you show an example of what your @import statements look like?

es128 avatar Jun 10 '16 19:06 es128

Well..

I am using the following directory structure :

|- app\
| `- styles\
|  |- app.scss
|  |- _partial_one.scss
|  |- _partial_two.scss
|  `- _partial_three.scss
|
|- bower_components\
| `- aSassFramework\
|   `- main.scss

So, the app.scss looks like :

@import "aSassFramework\main.scss";

@import "_partial_one.scss";
@import "_partial_two.scss";
@import "_partial_three.scss";

With these plugin options :

sass: {
  mode: 'native',
  options: {
    includePaths: ['bower_components']
  }
}

According to the brunch logs, when I save a partials file, the event is raised but nothing happens in the compiled one. To recompile the css output file, I need to save the app.scss (the main file).

Swizz avatar Jun 13 '16 08:06 Swizz

@Swizz it could be that you got to drop the leading _ on the partials path, and probably also the .scss at the end: see in the doc example how the _reset partial is imported as @import 'reset';

maxlath avatar Jun 13 '16 09:06 maxlath

Ow ! I have never used partials by this way.

But this does not work more. (Read : at the same way as before)

@import "aSassFramework\main";

@import "partial_one";
@import "partial_two";
@import "partial_three";

And I can not use files as individual ones due to variables and mixins imports.

Thank you for your time.


Here, the brunch-config.js

module.exports = {
  // See http://brunch.io for documentation.
  files: {
    javascripts: {
      joinTo: {
        'app.js': /^app/,
        'vendor.js': /^(bower_components|vendor)/
      }
    },
    stylesheets: {
      joinTo: {
        'app.css': /^app/,
        'vendor.css': /^(bower_components|vendor)/
      }
    },
    templates: {joinTo: 'app.js'}
  },
  plugins: {
    sass: {
      mode: 'native',
      options: {
        includePaths: ['bower_components']
      }
    },
    assetsmanager: {
      copyTo: {
        '.' : ['bower_components/**/font/*.ttf']
      }
    }
  }
}

Swizz avatar Jun 13 '16 09:06 Swizz

Hi @Swizz,

I was having this problem as well, but this issue answers the question:

#1

all imported .scss files, except for your single 'manifest' file, must be named with an underscore.

I had some additional 'manifest' files with a double underscore, and they weren't being recompiled, either. My dir structure looked like this:

├── base
│   ├── __base.scss
│   ├── _animations.scss
│   ├── _embeds.scss
│   ├── _fonts.scss
// ..etc.
├── main.scss

where main.scss included __base.scss, and __base.scss included all the files in its own directory.

Using a single underscore _base.scss fixed the issue.

bigsweater avatar Jul 16 '16 20:07 bigsweater