Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

NPM Styles order #1472

Open
solisoft opened this issue Aug 7, 2016 · 4 comments
Open

NPM Styles order #1472

solisoft opened this issue Aug 7, 2016 · 4 comments
Labels

Comments

@solisoft
Copy link

solisoft commented Aug 7, 2016

Description

npm styles order is ignored

npm: {
    styles: {
      uikit: [
        'dist/css/uikit.almost-flat.css', 
        'dist/css/components/datepicker.almost-flat.css',
        'dist/css/components/form-select.almost-flat.css',         
      ]
    }
  }

Expected behavior

Sorted using array order (css 1, css 2, css 3)

Actual behavior

CSS are sorted using alphabetic way

Environment

  1. Brunch: 2.8.2
  2. Node: 6.3.1
  3. NPM: 3.10.3
  4. Operating system: OSX

package.json contents

{
  "name": "arangodb-foxx-riot",
  "version": "1.0.0",
  "description": "Sample code",
  "main": "index.js",
  "scripts": {
    "start": "brunch watch --server"
  },
  "author": "Olivier BONNAURE",
  "license": "MIT",
  "homepage": "https://github.com/solisoft/arangodb-foxx-riotjs-sample",
  "dependencies": {
    "auto-reload-brunch": "^2.7.1",
    "brunch": "^2.8.2",
    "clean-css-brunch": "^2.0.0",
    "css-brunch": "^2.6.1",
    "digest-brunch": "^1.5.1",
    "html-pages-brunch": "^2.3.1",
    "javascript-brunch": "^2.0.0",
    "jquery": "^3.1.0",
    "riot": "^2.5.0",
    "riot-brunch": "0.0.4",
    "sass-brunch": "^2.6.3",
    "select2": "^4.0.3",
    "uglify-js": "^2.7.0",
    "uglify-js-brunch": "^2.0.1",
    "uikit": "^2.26.4",
    "underscore": "^1.8.3"
  }
}

brunch config contents

module.exports = {
  npm: {
    globals: {
      $: 'jquery',
      jQuery: 'jquery',
      _: "underscore",
      riot: "riot",
      UIKit: "uikit"
    },
    styles: {
      uikit: [
        'dist/css/uikit.almost-flat.css', 
        'dist/css/components/datepicker.almost-flat.css',
        'dist/css/components/form-select.almost-flat.css',         
      ],
      select2: ['dist/css/select2.css']
    }
  },
  files: {
    javascripts: {
      joinTo: {
        'js/js.js': /^app\/[js|widgets]/,
        'js/vendors.js': /^(?!app)/,    
      }
    },
    stylesheets: {
      joinTo: {
        'css/css.css': /^app\/[css]/,
        'css/vendors.css': /^(?!app)/,
      }
    },
  },
  plugins: {
    htmlPages: {
      compileAssets: true
    }
  },

  overrides: {
    production: {
      paths: {
        public: 'dist'
      }
    }

  }

};
@tkesgar
Copy link

tkesgar commented Aug 9, 2016

Maybe you can try reordering the styles at package.json? Brunch currently relies on the order of declaration in package.json to determine the order of pIugins (see #1377), so I wonder if it also works that way too for npm styles.

@solisoft
Copy link
Author

solisoft commented Aug 9, 2016

The things is that my CSS are coming from the same NPM module (uikit)

@solisoft
Copy link
Author

Any help will be welcome :)

@paulmillr paulmillr added the bug label Aug 20, 2016
@solisoft
Copy link
Author

solisoft commented Sep 8, 2016

My workaround is to use hooks

hooks: {
    preCompile: (end) => {
      var fs = require('fs');
      fs.createReadStream('node_modules/css/file.css').pipe(fs.createWriteStream('app/vendors/css_file.js'));
      end();
    }
  },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants