amarcruz / jscc Goto Github PK
View Code? Open in Web Editor NEWTiny and powerful preprocessor for conditional comments and replacement of compile-time variables in text files
License: MIT License
Tiny and powerful preprocessor for conditional comments and replacement of compile-time variables in text files
License: MIT License
I created a gulp plugin for jscc, could you please add a link in doument ?
https://www.npmjs.com/package/gulp-jscc
https://github.com/gucong3000/gulp-jscc
Hi
I was trying to do something like:
import thing from '../my-thing.js';
//#set _FOO = thing.object[key]
But am getting `thing is not defined in expression "thing.object[key]".
Is it possible to make this work?
Thank you for all your hard work. Any chance of a webpack plugin?
This is really cool! Any chance for a browserify plugin? I'd like to use jscc within budo during development which uses browserify under the hood.
Single line directives capture the comment ending token as part of the expression.
/* #if process.env.TARGET === 'chrome' */
Error: Invalid regular expression: missing / in expression "process.env.TARGET === 'chrome' */"
For languages such as css that don't have single line comments this means that directions must be two lines.
/* #if process.env.TARGET === 'chrome'
*/
eslint will insert spacing after //
and /*
// #set _DEBUG = 1 // this is a jscc comment
/* #if _DEBUG // closing this multiline comment */
// #if process.env.devmode === 'production'
// #set _DEBUG 0 // the `=` is optional
// #else anything after `#else` or `#endif` is ignored
/* eslint-disable no-console */
console.log('Debug mode on.');
// #endif
// #endif _DEBUG '_DEBUG' is ignored
So, jscc could not work.
//#if _JSCC__BUNDLE_FOO || _JSCC__BUNDLE_ALL
import foo from './controllers/foo';
//#endif
//#if _JSCC__BUNDLE_BAR || _JSCC__BUNDLE_ALL
import bar from './controllers/bar';
//#endif
//#if _JSCC__BUNDLE_BAZ || _JSCC__BUNDLE_ALL
import baz from './controllers/baz';
//#endif
I use Rollup and I want the user to control if each component should or should be loaded individually or simply allow all of them to be bundled. I saw no mention of this in the WIKI.
Also, why is the //#endif
needed? can you make so if it is omitted then only the code line directly below the if
is taken into account?
Thanks!
Two slashes within a literal regex or ES6 TL will break jscc expressions:
//#set _R = /\///
//#set _S = `//`
This is because the parser confuses the slashes in the content with the trailing comment.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.