How to use Bower components using Gulp

1

I use Gulp to help me in development, even if I need the bootstrap or low jquery I put in the folders I choose and ok, but I would like to use bower , but I do not quite understand what I do to use the components that are via bower as bootstrap , jquery , etc ...?

Is there any way to compile everything together with my files scss or js , etc ...

    
asked by anonymous 26.11.2015 / 19:03

1 answer

2

Using the gulp-useref plugin

It will concatenate files within each commented build block. In this link you can see the more detailed documentation.

link

<html>
<head>
    <!-- build:css css/style.css -->
    <link href="bower_components/bootstrap.css" rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">
    <!-- endbuild -->
</head>
<body>
    <!-- build:js scripts/bundle.js -->
    <script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="scripts/main.js"></script>
    <!-- endbuild -->
</body>
</html>

In the case of SASS, you need to compile the sass first, then include the css generated on the page inside the build block. And so generate a file with all the css's desired.

This plugin accomplishes this task:

link

    
29.03.2016 / 00:52