File tree 10 files changed +424
-0
lines changed
10 files changed +424
-0
lines changed Original file line number Diff line number Diff line change
1
+ # modules
2
+ node_modules
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * @todo parse files and rename
5
+ */
6
+ const rcs = require ( './utils/rcs' ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ /**
3
+ * parses through every single document and renames the names
4
+ * (require(hasten)).fileReplace
5
+ *
6
+ * @module fileReplace
7
+ */
8
+ const fileReplace = module . exports = { } ;
9
+
10
+ /**
11
+ * Parse a file and returns new selectors if the option 'isSelectors' is set to true
12
+ *
13
+ * @param {Object } options
14
+ * @property {String } regex a regular expression
15
+ * @property {String } prefix the prefix for renaming
16
+ * @property {Boolean } isSelectors a boolean to get new values for the selectorLibrary
17
+ *
18
+ * @return {Object }
19
+ */
20
+ fileReplace . replace = ( options ) => {
21
+
22
+ /**
23
+ * @todo get values from the selectorsLibrary - bail if empty
24
+ * @todo open files and replace it in the file
25
+ * @todo if isSelectors is enabled save the orig value for saving it into the library
26
+ */
27
+
28
+ return {
29
+ filename : '' ,
30
+ filetype : '' ,
31
+ prefix : '' ,
32
+ selectors : { // just if isSelectors is enabled (for CSS files)
33
+ orig : '' ,
34
+ new : ''
35
+ }
36
+ } ;
37
+ } ;
38
+
39
+ /**
40
+ * special replacements for css files - needs to store files in the selectorLibrary
41
+ * @param {[type] } options [description]
42
+ * @return {[type] } [description]
43
+ */
44
+ fileReplace . replaceCss = ( options ) => {
45
+
46
+ /**
47
+ * @todo replace css files
48
+ * @todo set isSelectors in options to true
49
+ * @todo get return values and save it into the library
50
+ */
51
+
52
+ } ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ /**
3
+ * @todo generates a new individual name
4
+ * @todo should have prefixes or not
5
+ */
6
+ const _ = require ( 'lodash' ) ;
7
+
8
+ /**
9
+ * nameGenerator will create new and unique names
10
+ * (require(hasten)).nameGenerator
11
+ *
12
+ * @module nameGenerator
13
+ */
14
+ const nameGenerator = module . exports = { } ;
15
+
16
+ /**
17
+ * generates a new unique name
18
+ *
19
+ * @param {String } [prefix] add an individual prefix to the generated name
20
+ * @return {String }
21
+ */
22
+ nameGenerator . generate = prefix => {
23
+ return 'new selector' ;
24
+ } ; // generate
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * @todo get() minified or original selector
5
+ */
6
+ class SelectorLibrary {
7
+ constructor ( ) {
8
+ this . selectors = { } ;
9
+ }
10
+
11
+ /**
12
+ * gets a specific selector
13
+ *
14
+ * @param {String } the selector
15
+ * @return {String }
16
+ */
17
+ get ( selector ) {
18
+ return selector ;
19
+ }
20
+
21
+ /**
22
+ * gets all selectors
23
+ *
24
+ * @return {[type] } [description]
25
+ */
26
+ getAll ( ) {
27
+ return this . selctors ;
28
+ }
29
+
30
+ /**
31
+ * generates a file including all old and new selectors/names
32
+ * includes also unused class selectors
33
+ */
34
+ generateLibraryFile ( ) {
35
+ }
36
+ } ;
37
+
38
+ /**
39
+ * creates a new selectorLibrary
40
+ * (require(hasten)).selectorLibrary
41
+ *
42
+ * @module selectorLibrary
43
+ */
44
+ exports = module . exports = new SelectorLibrary ( ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * @todo import options
5
+ */
6
+
7
+ const rcs = module . exports = { } ;
8
+
9
+ const doRequire = name => {
10
+ return rcs [ name ] = require ( './options/' + name ) ;
11
+ } ;
12
+
13
+ doRequire ( 'fileReplace' ) ;
14
+ doRequire ( 'nameGenerator' ) ;
15
+ doRequire ( 'selectorLibrary' ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " rename-css-selectors" ,
3
+ "version" : " 0.0.0" ,
4
+ "description" : " Rename css classes and id's in files" ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " mocha"
8
+ },
9
+ "repository" : {
10
+ "url" : " https://www.github.com/JPeer264/rename-css-selectors" ,
11
+ "type" : " git"
12
+ },
13
+ "author" : " Jan Peer Stöcklmair" ,
14
+ "license" : " MIT" ,
15
+ "dependencies" : {
16
+ "commander" : " ^2.9.0" ,
17
+ "fs-extra" : " ^0.30.0" ,
18
+ "lodash" : " ^4.16.4"
19
+ },
20
+ "devDependencies" : {
21
+ "chai" : " ^3.5.0" ,
22
+ "mocha" : " ^3.1.2"
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments