css - What are some good ideas for automatically including external link tags from inside of an NPM component folder, into a larger project using Gulp? -


what ideas automatically including external <link> tags inside of /node_modules/mycomponent/ folder, larger project using gulp?

the external <link> tags use absolute paths, appear similar this:

<link rel="stylesheet" href="https://www.somecdn.com/somepath/somelibrary.css"/> 

example font-awesome cdn href, previous <link> tag:

href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" 

problem: have component, uses font awesome icons & external <link> tag similar what's shown above. when include component module of larger project, icons disappear larger project. yet icons appear correctly in component.

what i've tested: when test component itself, icons displayed on-screen. stylesheet's external url correct. component renders correctly in-browser stand-alone npm component. using npm test cli shows unit tests pass green checkmarks.

possible solutions: know can copy & paste <link> tag main project or download of internal css files using answer this post...

however: i'm not looking include relatively pathed css files larger project, has been asked in post. i'm looking include else's absolutely pathed (3rd party cdn code) larger project.

time-saving & cost-saving reasons: don't want dig through 100+ /node_modules/ folders find else's /css/ folders + files, nor have download 10-20 cdn hosted libraries like: jquery, moderinzr, underscore, bootstrap, sass, less, etc... each 1 uses different external cdn own <link> tag. require build internal css library of cdn files. files served cdn, using answer. serving else's cdn hosted libraries seems waste of website's bandwidth or of clients' website(s) bandwidth, when should come original cdn. high-traffic websites (ie. popular), serving cdn libraries site(s) require more bandwidth & cost more money, linking original cdn websites.

enigma: i'm wondering if it's possible automatically extract <link> tags or pass external css url paths /node_modules/mycomponent/ 1 level & roll them larger projects using gulp. if so, pass them concatenation task, similar basic example:

const mycomponent = require("mycomponent") const browserify = require('browserify') const source = require('vinyl-source-stream')  gulp.task('bundle', function (cb) {   browserify('somehow find <link> tags in /node_modules/...')    // ^-- right tool finding <link> tags in /node_modules/?   .bundle() // or similar concat task/process   // <- minification go here.   .pipe(source('bundle.css')) // creates output file name.   .pipe(gulp.dest('./css/')) // writes bundled file file system.   return cb() }) 

does have recommendations or best practice approaches on how this?


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -