gulp

Using Gulp, is it possible to add environment variables as a comment into CSS? (for example the package.json version)

£可爱£侵袭症+ 提交于 2020-06-28 04:45:20
问题 Is it possible to pipe through specific environment variables in an SCSS file using a gulp setup? Could you, for example, use something like: /*! %version% */ Where version would be the version number as used in package.json. 回答1: From gulp-header example: // using data from package.json var pkg = require('./package.json'); //var banner = ['/**', // ' * <%= pkg.name %> - <%= pkg.description %>', // ' * @version v<%= pkg.version %>', // ' * @link <%= pkg.homepage %>', // ' * @license <%= pkg

Require file with a variable in React JS

孤街醉人 提交于 2020-06-12 02:45:07
问题 I'm trying to require a file with a variable in the path. Something like const langCode = this.props.langCode; // en let languageFile = require('../common/languages/' + langCode); Where langCode can be fr, en, de, nl. Thus what I'm trying to get is for example require('../common/languages/en'); When I type it without variable at the end, thus require('../common/languages/en'); it works good. But when I try with require('../common/languages/' + langCode); it won't work, doesn't matter that the

Require file with a variable in React JS

坚强是说给别人听的谎言 提交于 2020-06-12 02:44:06
问题 I'm trying to require a file with a variable in the path. Something like const langCode = this.props.langCode; // en let languageFile = require('../common/languages/' + langCode); Where langCode can be fr, en, de, nl. Thus what I'm trying to get is for example require('../common/languages/en'); When I type it without variable at the end, thus require('../common/languages/en'); it works good. But when I try with require('../common/languages/' + langCode); it won't work, doesn't matter that the

npm install is missing modules

白昼怎懂夜的黑 提交于 2020-06-09 16:52:26
问题 Before I can run gulp in my project I need to run npm install . This works except on my computer, because I get the following error: Error: Cannot find module 'socket.io' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) ... I can fix this with $> npm install socket.io Now when I do the install command again I get Error: Cannot find module 'di' ... When I install di and run the install command again I get:

Can i call a Method from an external JS File in a ServiceWorker?

江枫思渺然 提交于 2020-06-03 12:34:43
问题 Is it possible to call a function from a JavaScript file out of an ServiceWorker? Directory root static js serviceworker.js tmpBuild js pages Overview.js serviceworker.js has to call a method from Overview.js ! Is that possible? And How? 回答1: You can use importScripts() https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts importScripts('https://example.com/script.js'); 来源: https://stackoverflow.com/questions/46932176/can-i-call-a-method-from-an-external-js-file-in

Can i call a Method from an external JS File in a ServiceWorker?

那年仲夏 提交于 2020-06-03 12:30:23
问题 Is it possible to call a function from a JavaScript file out of an ServiceWorker? Directory root static js serviceworker.js tmpBuild js pages Overview.js serviceworker.js has to call a method from Overview.js ! Is that possible? And How? 回答1: You can use importScripts() https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts importScripts('https://example.com/script.js'); 来源: https://stackoverflow.com/questions/46932176/can-i-call-a-method-from-an-external-js-file-in

Cannot find module 'react/lib/warning' - Error with React version

送分小仙女□ 提交于 2020-06-01 07:39:29
问题 I'm trying to run the "gulp nodemon" to check an application made in REACT but I get the following error: internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module 'react/lib/warning' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/home/kevin/hbtn/Fix_My

Locally installed gulp not running in command line?

橙三吉。 提交于 2020-05-24 21:12:05
问题 I am new to nodejs and gulp stuff. I working on a nodejs project in which I have to run jslint on all the files. I am using gulp for this purpose. My problem is that In order to run gulp on cli I don't want to install gulp globally and also does not want to update my path variable, So I have installed gulp and other node modules in my project locally using the package.json file cd myproject npm install Since I don't want to install gulp globally and want to run the local gulp I have added

Locally installed gulp not running in command line?

↘锁芯ラ 提交于 2020-05-24 21:11:12
问题 I am new to nodejs and gulp stuff. I working on a nodejs project in which I have to run jslint on all the files. I am using gulp for this purpose. My problem is that In order to run gulp on cli I don't want to install gulp globally and also does not want to update my path variable, So I have installed gulp and other node modules in my project locally using the package.json file cd myproject npm install Since I don't want to install gulp globally and want to run the local gulp I have added

sequelize.sync({ force: true }) is not working some times

╄→гoц情女王★ 提交于 2020-05-15 05:19:24
问题 i am using gulp tasks for migration of database. For testing purpose i am using different database. so i need exactly same database. i am trying to do with sequelize.sync({ force: true }) but its not working. i am having my all models in portal-model. here is the code: const models = require('portal-models'); gulp.task('migrate', ['create-database'], (done) => { models.sequelize.query('SET FOREIGN_KEY_CHECKS = 0') .then(() => models.sequelize.sync({ force: true, alter: true })) .... .... ....