question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Partial .scss files are compiled although they were not included in main .scss file

See original GitHub issue

Hi!

I am starting a new brunch project after so long time.

By the moment I have the following scss structure:

styles/ ├──features/ ├──├──directives/ ├──├──├──loading/ ├──├──├──├──_loading.scss ├──lib/ ├──├──_global.scss ├──├──_globalLasts.scss ├──├──_variables.scss ├──views/ ├──├──_gallery.scss ├──├──_home.scss ├──styles.scss

The styles.scss content is:

// Libraries
@import "lib/variables";
@import "lib/global";

// Components
@import "features/directives/loading/loading";

// Layouts

// Views
@import "views/gallery";
@import "views/home";

@import "lib/globalLasts";

My brunch-config.js file is the fllowing one:

exports.config = {
    npm: {
        enabled: false
    },
    fileListInterval: 2000,
    files: {
        javascripts: {
            joinTo: {
                'js/app.js': /^app(\/|\\)angular/,
                'js/vendor.js': /^(app(\/|\\)vendor|bower_components)/
            },
            order: {
                before: [
                    'bower_components/angular/angular.js',
                    'bower_components/angular-ui-router/release/angular-ui-router.js',
                    'bower_components/angular-animate/angular-animate.js',
                    'bower_components/angular-touch/angular-touch.js',
                    'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
                ],
                after: [
                    'app/angular/router/router.js',
                    'app/angular/app.js'
                ]
            }
        },
        stylesheets: {
            order: {
                before: []
            },
            joinTo: {
                'css/app.css': /^app(\/|\\)angular(\/|\\)styles/,
                'css/vendor.css': /^(app(\/|\\)vendor|bower_components)/
            }
        },
        templates: {
            joinTo: {
                'js/templates.js': /^app(\/|\\)angular(\/|\\)views/
            }
        }
    },
    modules: {
        wrapper: false,
        definition: false
    },
    plugins: {
        jshint: {
            pattern: /^app(\/|\\)angular(\/|\\).*\.js$/,
            options: {
                strict: true,
                bitwise: true,
                curly: true,
                unused: true,
                eqeqeq: true
            },
            warnOnly: true
        },
        digest: {
            alwaysRun: false,
            environments: ['production']
        },
        afterBrunch: [
            'rm -f public/config/config_*.json',
            'cp bower_components/components-font-awesome/fonts/* public/fonts',
            'cp bower_components/bootstrap/fonts/* public/fonts'
        ],
        uglify: {
            mangle: false
        },
        browserSync: {
            watch: true,
            port: 3333,
            logLevel: "debug"
        }
    },
    // Configuracion especifica del servidor NodeJS utilizado mediante Brunch
    server: {
        path: 'app.js',
        port: 3333,
        base: '/'
    }
};

I remember that the correct way is define a main file (style.scss) and other like partials (starting with underscore: _).

However, I am getting an error when compiling my brunch project, because I am using a $color variable in _loading.scss file that is declared in lib/_variables.scss file.

I tried to comment all @imports from my styles.scss file and I saw that the partials file are compiled always, although I don’t add them yo my main file.

I reviewed the docs and I can see that the partial files are ignored if they starts with underscore.

The version of sass-brunch I am using is 2.10.7.

Am I doing something wrong? Or there is now another way for ignore the partials file?

Thank you so much.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
dlepauxcommented, Nov 5, 2018

Hello @paulmillr, I think having found the issue. Here my PR https://github.com/brunch/sass-brunch/pull/181

There is just one thing that I don’t fully understand, the @import '../../app/styles/globbed/* seem to not work with my changes… And IDK why…

[EDIT] Oh yeah ! I succeed 😄

1reaction
dlepauxcommented, Jan 12, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

html - New rules are not feeding from a partial .scss files into ...
You need to check the output files and your SCSS compilation process to make sure your output files are being compiled.
Read more >
Importing Sass Partials - LearnHowToProgram.com
The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS...
Read more >
How to Use Sass with CSS - freeCodeCamp
When you write Sass code in a .scss file, it is compiled into a regular CSS file that the browser will use to...
Read more >
File watcher not triggered on Save on SCSS files starting with ...
File Watchers do not know what tools do: compile or format code. Processing partial files without this trick may cause unwanted partial files...
Read more >
Sass @import is being replaced with @use and @forward
My course: Responsive Design for Beginners! https://coder-coder.com/responsive/ Become a full-stack web dev with Zero to Mastery: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found