Skip to content

Missing --load-path option #67

@justin-oh

Description

@justin-oh

In the documentation for integrating Bootstrap, it is recommended to composer require twbs/bootstrap then @import '../../vendor/twbs/bootstrap/scss/bootstrap'. It becomes cumbersome, tedious, ugly, etc. to maintain relative pathing like that. If you have to move a file, you must update these paths.

To make matters worse, I have my own bundle with a Resources/public directory that copies some Sass into the public directory of the Symfony project. So now I have to think like this:

/* vendor/org/style-bundle/src/Resources/public/scss/style.scss */

// this file (style.scss) will be copied to /public/bundles/orgstyle/scss/style.scss
// so we need to reference the Bootstrap vendor files from that location
@import '../../../../vendor/twbs/bootstrap/scss/bootstrap';

I could of course not put the Sass file in the public directory, but my import would still look ugly:

/* vendor/org/style-bundle/src/Resources/scss/style.scss */

@import '../../../../../twbs/bootstrap/scss/bootstrap';

I don't think the --load-path option would necessarily need to be exposed to the developer, but it would be nice if the bundle provided some basic/common load paths like this:

--load-path=/absolute/path/to/project/node_modules --load-path=/absolute/path/to/project/vendor

Then we can at least have more readable/maintainable Sass imports for 3rd party code:

@import 'twbs/bootstrap/scss/bootstrap';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions