Skip to content

[Feature Request] Stylesheet Vendor Imports #1122

Closed

Description

@Daeluse
  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
  • Do you want to request a feature or report a bug?
    Feature Request
  • What is the current behavior?
    Import statements in entry points for CSS and SASS are not currently working,
  • What is the expected behavior?
    Adding an Import statement in any of the entry points (IE Vendor) for a SASS (.scss) or a CSS (.css) file should result in that stylesheet being bundled into the global css for the application.
  • What is the motivation / use case for changing the behavior?
    Some modules, such as Bootstrap V4, require stylesheets to be imported into the application to enable certain features, such as the flex grid. There are current workarounds in place, but they are bulky and bloated. This method of importing stylesheets used to work in the original builds of this seed project.*

Activity

  1. Daeluse commented on Oct 24, 2016

    @Daeluse
    Author

    Using the following loaders in the mean time, no guarantee they will work in everyone's case, but they provide the temporary fix until we can get some vetted support for this.

    const ExtractTextPlugin = require('extract-text-webpack-plugin');
    ...
    {
      test: /\.scss$/,
      exclude: helpers.root('node_modules'),
      loaders: ['raw-loader', 'sass-loader']
    },
    
    {
      test: /\.scss$/,
      include: helpers.root('node_modules'),
      loaders: ["style", "css", "sass"]
    },
    
    {
      test: /\.css$/,
      exclude: helpers.root('src', 'app'),
      loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css', 'postcss']})
    },
    
    {
      test: /\.css$/,
      include: helpers.root('src', 'app'),
      loader: 'raw!postcss'
    },
    ...
    plugins: [
      new ExtractTextPlugin('[name].[hash].css'),
    
  2. davidalee commented on Dec 27, 2016

    @davidalee

    Any reason why importing css/scss files worked in previous builds but is no longer working in the current build?

  3. shlomiassaf commented on Dec 28, 2016

    @shlomiassaf
    Contributor

    @davidalee Works for me...

    Component resources does not work with AOT (styleUrls, templateUrl) since they don't go through the loader chain.

    It will be fixed in a short period I believe.

  4. davidalee commented on Dec 28, 2016

    @davidalee

    @shlomiassaf I'm having issues with importing global styles into the vendor bundle

  5. shlomiassaf commented on Dec 28, 2016

    @shlomiassaf
    Contributor
  6. joshwiens commented on Dec 28, 2016

    @joshwiens
    Contributor

    See #1304

  7. davidalee commented on Dec 28, 2016

    @davidalee

    #1304 resolves this issue for me

  8. joshwiens commented on Dec 28, 2016

    @joshwiens
    Contributor

    For all those in this thread, the proposed solution is outline in the PR #1304 from @colinskow. If you want a say in how this is implemented, now would be the time to do so. If nobody objects, i'll be landing that by e.o.d

  9. Daeluse commented on Dec 28, 2016

    @Daeluse
    Author

    #1304 Does not provide the loader for SASS files in test environments. Other than that, the PR takes care of the issue in the current version of the repo.

  10. colinskow commented on Dec 28, 2016

    @colinskow
    Contributor

    Generally Karma doesn't need external stylesheets, and unit tests probably shouldn't be dependent on them. So I purposely left it out of the test config. Tests will launch faster.

  11. joshwiens commented on Dec 28, 2016

    @joshwiens
    Contributor

    Unit test definitely shouldn't be dependent on style sheets any more than they should depend on data. @colinskow is correct in his test implementation.

  12. Daeluse commented on Dec 28, 2016

    @Daeluse
    Author

    Karma will not launch without error unless I add a null loader for SASS in my environment. The purpose is not to incorporate them but to ensure that the file types will be handled appropriately when encountered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions