GithubHelp home page GithubHelp logo

Comments (5)

jlu1202 avatar jlu1202 commented on June 29, 2024 1

Hi, I seem to have a similar problem with wiredep prepending relative paths to bower_components in the processed html file.

Below is the code I have in my gulpfile.js and gulp.config.js

(gulpfile.js)
gulp.task('wiredep', function () {
log('Wire up the bower css js and our app js into the html');
var options = config.getWiredepDefaultOptions();
var wiredep = require('wiredep').stream;

return gulp
    .src(config.index)
    .pipe($.debug(true))
    .pipe(wiredep(options))
    .pipe($.inject(gulp.src(config.js)))
    .pipe(gulp.dest(config.client));

}

(gulp.config.js)
var config = {
/**
* File paths
/
// all js to vet
alljs: [
'./src/__/
.js',
'./*.js'
],
build: './build/',
client: client,
server: server,
temp: temp,

    css: temp + 'styles.css',
    fonts: './bower_components/font-awesome/fonts/**/*.*',
    htmltemplates: clientApp + '**/*.html',
    images: client + 'images/**/*.*',

    index: client + 'index.html',

    js: [
        clientApp + '**/*.module.js',
        clientApp + '**/*.js',
        '!' + clientApp + '**/*.spec.js',
    ],

    less: client + 'styles/styles.less',

    /*
     * template cache
     */
    templateCache: {
        file: 'template.js',
        options: {
            module: 'app.core',
            standAlone: false,
            root: 'app/'
        }
    },

    /*
     * browser sync
     */
    browserReloadDeplay: 1000,

    /*
     * Bower and NPM locations
     */
    bower: {
        json: require('./bower.json'),
        directory: './bower_components/',
        ignorePath: '../..'
    },

    /**
     * Node settings
     */
    defaultPort: 7203,
    nodeServer: './src/server/app.js'
};

config.getWiredepDefaultOptions = function () {
    var options = {
        bowerJson: config.bower.json,
        directory: config.bower.directory,
        ignorePath: config.bower.ignorePath
    };
};

Index.html (before running gulp task)

<!-- build:css styles/lib.css -->
<!-- bower:css -->
<link rel="stylesheet" href="/bower_components/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="/bower_components/toastr/toastr.css" />
<!-- endbower -->
<!-- endbuild -->

index.html (after running gulp task)

<!-- build:css styles/lib.css -->
<!-- bower:css -->
<link rel="stylesheet" href="../../bower_components/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="../../bower_components/toastr/toastr.css" />
<!-- endbower -->
<!-- endbuild -->

Any pointer would be highly appreciated!

from generator-gulp-angular.

zckrs avatar zckrs commented on June 29, 2024

Do you install Django with 'bower install' ?

from generator-gulp-angular.

debuggerpk avatar debuggerpk commented on June 29, 2024

django is a python package . there shouldn't be any need for it, i had been doing the same thing with grunt without using bower install package for django

from generator-gulp-angular.

debuggerpk avatar debuggerpk commented on June 29, 2024

okay, must include the gulp.dest, the final looks like this

gulp.src('../../templates/backoffice/__base.html')
    .pipe(wiredep({
      ignorePath: '../../static/',
      fileTypes: {
        html: {
          replace: {
            js: '<script src="{{ STATIC_URL }}{{filePath}}"></script>',
            css: '<link rel="stylesheet" href="{{ STATIC_URL }}{{filePath}}" />'
          }
        }
      }
    }))
    .pipe(gulp.dest('../../templates/backoffice'));

from generator-gulp-angular.

zckrs avatar zckrs commented on June 29, 2024

Right.
Without gulp.dest you don't have new file.

from generator-gulp-angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.